sto provando a usare bertopic co llama2 come representation_model attraverso l'uso di questo codice
from huggingface_hub import notebook_login
notebook_login()

from torch import cuda

model_id = 'meta-llama/Llama-2-7b-chat-hf'
device = f'cuda:{cuda.current_device()}' if cuda.is_available() else 'cpu'

print(device)

from torch import bfloat16
import transformers

# set quantization configuration to load large model with less GPU memory
# this requires the `bitsandbytes` library

bnb_config = transformers.BitsAndBytesConfig(
    load_in_4bit=True,  # 4-bit quantization
    bnb_4bit_quant_type='nf4',  # Normalized float 4
    bnb_4bit_use_double_quant=True,  # Second quantization after the first
    bnb_4bit_compute_dtype=bfloat16  # Computation type
)

# Llama 2 Tokenizer
tokenizer = transformers.AutoTokenizer.from_pretrained(model_id)

# Llama 2 Model
model = transformers.AutoModelForCausalLM.from_pretrained(
    model_id,
    trust_remote_code=True,
    quantization_config=bnb_config,
    device_map='auto',
)
model.eval()

# Our text generator
generator = transformers.pipeline(
    model=model, tokenizer=tokenizer,
    task='text-generation',
    temperature=0.1,
    max_new_tokens=500,
    repetition_penalty=1.1
)

# System prompt describes information given to all conversations
system_prompt = """


 

You are a helpful, respectful and honest assistant for labeling topics.


"""

# Example prompt demonstrating the output we are looking for
example_prompt = """
I have a topic that contains the following documents:
- Traditional diets in most cultures were primarily plant-based with a little meat on top, but with the rise of industrial style meat production and factory farming, meat has become a staple food.
- Meat, but especially beef, is the word food in terms of emissions.
- Eating meat doesn't make you a bad person, not eating meat doesn't make you a good one.

The topic is described by the following keywords: 'meat, beef, eat, eating, emissions, steak, food, health, processed, chicken'.

Based on the information about the topic above, please create a short label of this topic. Make sure you to only return the label and nothing more.


 Environmental impacts of eating meat
"""

# Our main prompt with documents ([DOCUMENTS]) and keywords ([KEYWORDS]) tags
main_prompt = """


I have a topic that contains the following documents:
[DOCUMENTS]

The topic is described by the following keywords: '[KEYWORDS]'.

Based on the information about the topic above, please create a short label of this topic. Make sure you to only return the label and nothing more.


"""

prompt = system_prompt + example_prompt + main_prompt

from bertopic.representation import TextGeneration

# Text generation with Llama 2
llama2 = TextGeneration(generator, prompt=prompt)
representation_model = {
    "Llama2": llama2,
}

# Create our BERTopic model
topic_model = BERTopic(representation_model=representation_model,  verbose=True)
tuttavia ottengo questo errore 
PackageNotFoundError                      Traceback (most recent call last)
Cell In[12], line 17
     12 import transformers
     14 # set quantization configuration to load large model with less GPU memory
     15 # this requires the `bitsandbytes` library
---> 17 bnb_config = transformers.BitsAndBytesConfig(
     18     load_in_4bit=True,  # 4-bit quantization
     19     bnb_4bit_quant_type='nf4',  # Normalized float 4
     20     bnb_4bit_use_double_quant=True,  # Second quantization after the first
     21     bnb_4bit_compute_dtype=bfloat16  # Computation type
     22 )
     24 # Llama 2 Tokenizer
     25 tokenizer = transformers.AutoTokenizer.from_pretrained(model_id)

File /opt/conda/lib/python3.10/site-packages/transformers/utils/quantization_config.py:400, in BitsAndBytesConfig.__init__(self, load_in_8bit, load_in_4bit, llm_int8_threshold, llm_int8_skip_modules, llm_int8_enable_fp32_cpu_offload, llm_int8_has_fp16_weight, bnb_4bit_compute_dtype, bnb_4bit_quant_type, bnb_4bit_use_double_quant, bnb_4bit_quant_storage, **kwargs)
    397 if kwargs:
    398     logger.warning(f"Unused kwargs: {list(kwargs.keys())}. These kwargs are not used in {self.__class__}.")
--> 400 self.post_init()

File /opt/conda/lib/python3.10/site-packages/transformers/utils/quantization_config.py:458, in BitsAndBytesConfig.post_init(self)
    455 if not isinstance(self.bnb_4bit_use_double_quant, bool):
    456     raise TypeError("bnb_4bit_use_double_quant must be a boolean")
--> 458 if self.load_in_4bit and not version.parse(importlib.metadata.version("bitsandbytes")) >= version.parse(
    459     "0.39.0"
    460 ):
    461     raise ValueError(
    462         "4 bit quantization requires bitsandbytes>=0.39.0 - please upgrade your bitsandbytes version"
    463     )

File /opt/conda/lib/python3.10/importlib/metadata/__init__.py:996, in version(distribution_name)
    989 def version(distribution_name):
    990     """Get the version string for the named package.
    991 
    992     :param distribution_name: The name of the distribution package to query.
    993     :return: The version string for the package as defined in the package's
    994         "Version" metadata key.
    995     """
--> 996     return distribution(distribution_name).version

File /opt/conda/lib/python3.10/importlib/metadata/__init__.py:969, in distribution(distribution_name)
    963 def distribution(distribution_name):
    964     """Get the ``Distribution`` instance for the named package.
    965 
    966     :param distribution_name: The name of the distribution package as a string.
    967     :return: A ``Distribution`` instance (or subclass thereof).
    968     """
--> 969     return Distribution.from_name(distribution_name)

File /opt/conda/lib/python3.10/importlib/metadata/__init__.py:548, in Distribution.from_name(cls, name)
    546         return dist
    547 else:
--> 548     raise PackageNotFoundError(name)

PackageNotFoundError: No package metadata was found for bitsandbytes