bertopic version 0.16.0 - when adding representation model together with zeroshot_topic_list end with failure
from bertopic import BERTopic
2024-05-02 10:26:56,345 - BERTopic - Zeroshot Step 2 - Completed ✓
2024-05-02 10:26:56,346 - BERTopic - Zeroshot Step 3 - Combining clustered topics with the zeroshot model
KeyError: '-1'
File
topic_model = BERTopic(
Pipeline models
embedding_model=embedding_model, umap_model=umap_model, hdbscan_model=hdbscan_model, vectorizer_model=vectorizer_model, zeroshot_topic_list=zero_shot_topics_list, zeroshot_min_similarity=.8, representation_model=representation_model,
Hyperparameters
top_n_words=10, verbose=True )
topics, probs = topic_model.fit_transform(docs, embeddings)
This was indeed an issue with 0.16.0 but might be fixed with 0.16.1 but I'm not sure if it will work. There's currently a PR open for 0.16.1 that fixes another issue.
The reason i work with 0.16.0 is because zero shot is failing on 0.16.1. i saw there are opened cases for that already
Have you tried 0.16.1 with the PR I mentioned above? I think that should solve your issue.