MaartenGr / BERTopic

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

ValueError: zero-size array to reduction operation maximum which has no identity #725

Closed dwissaaj closed 2 years ago

dwissaaj commented 2 years ago

I try a simple list like this

test = ["I want to test Bertopic",
        "When I use it I got an error"]
bertopic = BERTopic().fit_transform(test)

But I got an error with

ValueError                                Traceback (most recent call last)
[<ipython-input-53-ea2ec26cbbeb>](https://localhost:8080/#) in <module>
----> 1 bertopic = BERTopic().fit_transform(test)

5 frames
[/usr/local/lib/python3.7/dist-packages/numpy/core/_methods.py](https://localhost:8080/#) in _amax(a, axis, out, keepdims, initial, where)
     38 def _amax(a, axis=None, out=None, keepdims=False,
     39           initial=_NoValue, where=True):
---> 40     return umr_maximum(a, axis, None, out, keepdims, initial, where)
     41 
     42 def _amin(a, axis=None, out=None, keepdims=False,

ValueError: zero-size array to reduction operation maximum which has no identity

I use huggingface for model embedding. Any clue Why this happen?

Script

Google Colab

Originally posted by @dwissaaj in https://github.com/MaartenGr/BERTopic/discussions/717#discussioncomment-3666736

dwissaaj commented 2 years ago

Solved

zhimin-z commented 1 year ago

How did you solve it, I have the same issue... @dwissaaj