BERTopic icon indicating copy to clipboard operation
BERTopic copied to clipboard

ModuleNotFoundError: No module named 'bertopic._ctfidf'

Open anthobio23 opened this issue 2 years ago • 1 comments

Hi, I'm trying to load a model by entering bertopic. but i get this error:

`--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) in ----> 1 modelo_topico_secciones = BERTopic.load('drive/MyDrive/Copia de modelo_topicosSecciones_GPU_EL_BUENO')

5 frames /usr/local/lib/python3.7/dist-packages/bertopic/_bertopic.py in load(cls, path, embedding_model) 2195 topic_model.embedding_model = select_backend(embedding_model) 2196 else: -> 2197 topic_model = joblib.load(file) 2198 return topic_model 2199

/usr/local/lib/python3.7/dist-packages/joblib/numpy_pickle.py in load(filename, mmap_mode) 575 filename = getattr(fobj, 'name', '') 576 with _read_fileobject(fobj, filename, mmap_mode) as fobj: --> 577 obj = _unpickle(fobj) 578 else: 579 with open(filename, 'rb') as f:

/usr/local/lib/python3.7/dist-packages/joblib/numpy_pickle.py in _unpickle(fobj, filename, mmap_mode) 504 obj = None 505 try: --> 506 obj = unpickler.load() 507 if unpickler.compat_mode: 508 warnings.warn("The file '%s' has been generated with a "

/usr/lib/python3.7/pickle.py in load(self) 1086 raise EOFError 1087 assert isinstance(key, bytes_types) -> 1088 dispatchkey[0] 1089 except _Stop as stopinst: 1090 return stopinst.value

/usr/lib/python3.7/pickle.py in load_global(self) 1374 module = self.readline()[:-1].decode("utf-8") 1375 name = self.readline()[:-1].decode("utf-8") -> 1376 klass = self.find_class(module, name) 1377 self.append(klass) 1378 dispatch[GLOBAL[0]] = load_global

/usr/lib/python3.7/pickle.py in find_class(self, module, name) 1424 elif module in _compat_pickle.IMPORT_MAPPING: 1425 module = _compat_pickle.IMPORT_MAPPING[module] -> 1426 import(module, level=0) 1427 if self.proto >= 4: 1428 return _getattribute(sys.modules[module], name)[0]

ModuleNotFoundError: No module named 'bertopic._ctfidf'


NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the "Open Examples" button below. ---------------------------------------------------------------------------`

It has already worked fine for me but I run it today and now I get this error that I can't identify. can you help me?

anthobio23 avatar Sep 13 '22 20:09 anthobio23

Although I am not entirely sure, I think you are loading in a model trained on a previous version of BERTopic (<v0.12) and tried to load it in with a current version (=v0.12). Since the API can change between releases, I would advise making sure that the environment you work in is kept the same between saving and loading the model. In other words, if you saved the model with v0.10, make sure to load it in with the same version.

MaartenGr avatar Sep 14 '22 07:09 MaartenGr

thank you

anthobio23 avatar Oct 18 '22 18:10 anthobio23