BERTopic
BERTopic copied to clipboard
KeyError: '_version_'
I get KeyError: 'version' error when running :
topics, probs = topic_model.fit_transform(doc)
I am running in env with no internet. I get this same error with KeyBERT as well.
283 if embeddings is None:
284 self.embedding_model = select_backend(self.embedding_model,
--> 285 language=self.language)
286 embeddings = self._extract_embeddings(documents.Document,
287 method="document",
63 if language:
64 if language.lower() in ["English", "english", "en"]:
---> 65 return SentenceTransformerBackend("all-MiniLM-L6-v2")
66 elif language.lower() in languages or language == "multilingual":
67 return SentenceTransformerBackend("paraphrase-multilingual-MiniLM-L12-v2")
41 self.embedding_model = embedding_model
42 elif isinstance(embedding_model, str):
---> 43 self.embedding_model = SentenceTransformer(embedding_model)
44 else:
45 raise ValueError("Please select a correct SentenceTransformers model: \n"
//envs/py3_7n/lib/python3.7/site-packages/sentence_transformers/SentenceTransformer.py in __init__(self, model_name_or_path, modules, device)
103 with open(os.path.join(model_path, 'config.json')) as fIn:
104 config = json.load(fIn)
--> 105 if config['__version__'] > __version__:
106 logger.warning("You try to use a model that was created with version {}, however, your version is {}. This might cause unexpected behavior or errors. In that case, try to update to the latest version.\n\n\n".format(config['__version__'], __version__))
107
KeyError: '__version__'
Although I am not familiar with this issue, I believe it stems from your environment. The package wants to load in a specific model from the internet and since you do not have a connection, it seems to be failing. How did you instantiate the model?
This issue still persists. Any fix for this?
@amikumar-infa Did you make sure that the environment in which you are working has ports open such that the model can be downloaded from the huggingface servers? Also, it might be worth starting from a completely fresh environment and installing BERTopic there.
@MaartenGr I am facing the same issue, I was able to download the model (download comepleted till 100%) and post that this error poped up.
@gandharvsuri Did you try starting from a completely fresh environment? That often helps in these kinds of cases. Also, did you try the other tips mentioned above?
Due to inactivity, I'll be closing this for now. If you have any questions or want to continue the discussion, I'll make sure to re-open the issue!