MaartenGr/BERTopic

Issue with loading BERTopic model. 'NNDescent' object has no attribute '_bit_trees'

Opened this issue · 3 comments

The code:

from bertopic import BERTopic
model_path = "/path/to/bertopic/model"
model = BERTopic.load(model_path)

The error:
AttributeError: 'NNDescent' object has no attribute '_bit_trees'

The solution:

I downgraded my pynndescent from 0.5.12 to 0.5.11. That solved the problem, but just bringing this to your attention in case there's a change that needs to be made moving forward.

Thank you for sharing! You might also be able to prevent this issue by installing the latest umap-learn which might have fixed this issue.

I'm having the same issue now, and neither downgrading the pynndescent nor installing umap-learn helped. Beforehand, I also had an issue with loading the model, for which I upgraded numba. Any suggestions? Thanks in advance!

@lucijakrusic Not quite sure what the solve is here. I assume you are loading from a pickle, right? In that case, you will need to make sure that all versions of all dependencies are exactly the same as when you saved the model.