MaartenGr / BERTopic

Leveraging BERT and c-TF-IDF to create easily interpretable topics.
https://maartengr.github.io/BERTopic/
MIT License
5.99k stars 752 forks source link

Embedding Error #1533

Open mjavedgohar opened 12 months ago

mjavedgohar commented 12 months ago

Hi @MaartenGr ,

I installed a Google package that updated some packages and after that I am getting the following error. Can you please help me to resolve this? Thanks

2023-09-19 16:43:58,838 - BERTopic - Transformed documents to Embeddings Traceback (most recent call last): topics, probs = topic_model.fit_transform(docs) File "... /bertopic/_bertopic.py", line 350, in fit_transform y, embeddings = self._guided_topic_modeling(embeddings) File "... /bertopic/_bertopic.py", line 2919, in _guided_topic_modeling seed_topic_embeddings = np.vstack([seed_topic_embeddings, embeddings.mean(axis=0)]) File "<__array_function__ internals>", line 5, in vstack File "... /site-packages/numpy/core/shape_base.py", line 282, in vstack return _nx.concatenate(arrs, 0) File "<__array_function__ internals>", line 5, in concatenate ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 46 and the array at index 1 has size 100

MaartenGr commented 12 months ago

It might be that numpy and/or numba were updated to incompatible versions. It might be worthwhile to go back to the environment you were before and see what was changed internally.

cosmozhang commented 10 months ago

I met a similar error. What version of numpy, scipy and numba did you test on? Thanks!

mjavedgohar commented 10 months ago

Hi @cosmozhang

I am using the following version of numpy and numba to restore the BERTopic. numpy=1.21.1 numba=0.53.1