-
Notifications
You must be signed in to change notification settings - Fork 764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No loop matching the specified signature and casting was found for ufunc add #202
Comments
Strange, I have been testing it in the last few days but I do not seem to be able to reproduce the error. Just to be sure, could you post the entire error message? I believe the true location of the error is missing in your error message. |
Here is the complete error message.
|
Could you share the versions of packages in your environment? Also, have you tried installing BERTopic in a clean environment? |
Yes, I re-installed in a new environment but got the same error when run guided bertopic, here is the list of package versions:
|
Seeing as it seems to be a numpy error, could you upgrade numpy with |
Hi Maarten, I think the issue may be related to
Below is the environment
And the error code
|
I took your code and used the 20Newsgroups dataset instead to try to reproduce your issue in a basic Google Colab session: import umap
import hdbscan
from sentence_transformers import SentenceTransformer
from sklearn.datasets import fetch_20newsgroups
docs = fetch_20newsgroups(subset='all', remove=('headers', 'footers', 'quotes'))["data"]
sentence_model = SentenceTransformer("paraphrase-MiniLM-L6-v2")
# define umap model to reduce embeddings dimensionality
umap_model = umap.UMAP(n_neighbors=15,
min_dist=0.0,
n_components=10,
metric='cosine',
low_memory=False,
random_state=42)
# define hdbscan model to perform documents clustering
hdbscan_model = hdbscan.HDBSCAN(min_cluster_size=50,
min_samples=15,
metric='euclidean',
cluster_selection_method='eom',
prediction_data=True)
# topics generated from keybert search
seed_topic_list = [['customer', 'order', 'service',
'quality', 'transaction', 'delivery',
'shopping', 'staff', 'product',
'store', 'online', 'stock',
'size', 'time', 'website']]
# import bertopic module
from bertopic import BERTopic
# create bertopic model
topic_model = BERTopic(top_n_words=10,
min_topic_size=10,
n_gram_range=(1,2),
calculate_probabilities=True,
umap_model=umap_model,
hdbscan_model=hdbscan_model,
embedding_model=sentence_model,
seed_topic_list=seed_topic_list,
low_memory=False,
verbose=True)
# train model, extract topics and probabilities
topics, probabilities = topic_model.fit_transform(docs) However, it works without any issue so far. So it seems that the issue is perhaps related to the dataset you are using. How large is your data? Also, could you update numpy with |
Hi Maarten, I think I may have stumbled upon the issue with Step 1:
Step 2:
Step 3:
I then run the model with
|
@gsalfourn I also have the same compatibility issue, so I have to degrade numpy to 1.20. But then the guided BERT still has the same error. Have you been able to run guided BERT? |
Yes, I was able to run |
|
Now, we have a strange/weird case on our hands. When I tried to run the same
The matching
|
@gsalfourn Yes, I am using Jupyter notebook, so it seems this error only occurs in Jupyter notebook. Thanks for your testing! |
I just tried it out in a Jupyter Notebook but unfortunately could not reproduce your issue. It seems that the issue can be found through a Numba/Numpy combination that does not work well together. The numba/numpy combo I use in the jupyter notebook/lab sessions:
I would advise installing the versions above since the new Numba release does not support numpy>1.20. See this issue. |
@MaartenGr Sorry for jumping in, as the reporter of the issue you mentioned (numba/numba#7339), new numba (0.54) does only support numpy==1.20 (with Python 3.7 on Linux) |
Yes, this combination works for me! Thanks to everybody! |
For what it's worth, I find that I have to downgrade numpy to 1.20.* and upgrade it again back to 1.21.1 every time I restart the environment on my local machine. |
I have the same issue. It seems that installing the above numpy version works for me. |
i tried plotting this And i got this error
|
i upgraded the version of NumPy as instructed above, it still doesn't work for me, i am using Jupyter Notebook |
@sheddyranking If I am not mistaken, it seems that your issue is related to |
yes sir |
It works for me when I change the numpy version to
|
Hi @MaartenGr, Thanks for releasing the new version of BERTopic with Guided Topic Modeling. However, I got an error message for my code
The error is
I don't think the error is caused by my "data_de", since it works well if I don't specify
seed_topic_list
. Any suggestions on fixing this error?The text was updated successfully, but these errors were encountered: