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

Issues Loading BERTopic #1783

Open Nilsooo opened 8 months ago

Nilsooo commented 8 months ago

Hi Maarten,

Huge fan of your work! However, since today, I receive the following error message, when loading BERTopic: TypeError: Dispatcher._rebuild() got an unexpected keyword argument 'impl_kind'

How I load the model:


from bertopic import BERTopic
import umap.umap_ as umap
import numpy as np

topic_model = BERTopic.load("mymodel")

I use: bertopic 0.16.0 numba 0.59.0 umap-learn 0.5.5 numpy 1.23.5

Can you help :)?

MaartenGr commented 8 months ago

Thank you for your kind words!

When loading in the model does not work anymore, then it must mean that the environment must have changed between saving and loading the model. I am assuming you are using pickle to save the BERTopic which is extra sensitive to changes in dependencies. In other words, make sure that the environment in which you loaded the model is exactly the same as the environment in which you saved the model. Down to the Python version and versions of all (sub-)dependencies.

Nilsooo commented 8 months ago

Thanks! yes sometimes its pretty easy 👍 downgrading numba to 0.58.1 did the job for me :)