Anyone getting this error

#1
by aleynahukmet - opened

I am trying to run code below:

model = BERTopic(
n_gram_range=(1, 2),
vectorizer_model=vectorizer_model,
nr_topics='auto',
min_topic_size=10,
diversity=0.7,
seed_topic_list=[
["experience", "bad", "good", "nice"],
["place", "atmosphere", "toilet", "clean"],
["staff", "waitress", "service"],
["wait", "time", "long"],
["food", "taste"]
],
calculate_probabilities=True).fit(docs, corpus_embeddings)

and I am getting this error :

/usr/local/lib/python3.10/dist-packages/bertopic/_bertopic.py in fit(self, documents, embeddings, images, y)
362 ```
363 """
--> 364 self.fit_transform(documents=documents, embeddings=embeddings, y=y, images=images)
365 return self
366

4 frames
/usr/local/lib/python3.10/dist-packages/bertopic/_bertopic.py in _create_topic_vectors(self, documents, embeddings, mappings)
4119 topic_embeddings_dict = {}
4120 for topic_to, topics_from in mappings.items():
-> 4121 topic_ids = topics_from["topics_from"]
4122 topic_sizes = topics_from["topic_sizes"]
4123 if topic_ids:

KeyError: 'topics_from'

I found a github issue about this error, someone said it worked for them when they upgraded BERTopic but its not the case for me. Does anyone know about this error?

Sign up or log in to comment