MaartenGr / MaartenGr/BERTopic
Zeroshot Topic Modeling With no Embedding Model
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
Hello @MaartenGr and thanks for the awesome bertopic library! I want to perform zeroshot topic modeling with no embedding model. I have used an external model to get embeddings of documents and zeroshot topic list. I have no access to that embedding model anymore.
Is it possible to run something like this without embedding model?
```
zeroshot_topic_list_embeddings = np.random.rand(len(zeroshot_topic_list), 1024).astype(np.float32)
document_embeddings = np.random.rand(len(docs), 1024).astype(np.float32)
sim = 0.8
ctfidf_model = ClassTfidfTransformer(reduce_frequent_words=True)
representation_model = KeyBERTInspired(top_n_words=200)
topic_model = BERTopic(
top_n_words = 20,
ctfidf_model=ctfidf_model,
verbose=True,
calculate_probabilities = True,
embedding_model=None,
min_topic_size=200,
zeroshot_topic_list=zeroshot_topic_list,
zeroshot_min_similarity=sim,
representation_model=representation_model
)
topics, probs = topic_model.fit_transform(docs,document_embeddings)
topics, probs = topic_model.transform(docs,document_embeddings)
freq = topic_model.get_topic_info()
```
I think somewhere in the code Bertopic is still trying to use the embedding model
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the BERTopic fit_transform and transform entry points shown in the example, using supplied document embeddings with embedding_model=None and zeroshot_topic_list. Trace the zeroshot path to identify where an embedding model is still required; done means both calls complete without access to the original embedding model.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100