AttributeError: Gensim 4.0.0

File “/app/prediction_model/untitled1000.py”, line 123, in

df[‘mol2vec_API’] = [DfVec(x) for x in sentences2vec(df[‘sentence_API’], w2vec_model, unseen=‘UNK’)]

File “/home/appuser/venv/lib/python3.9/site-packages/mol2vec/features.py”, line 425, in sentences2vec

keys = set(model.wv.vocab.keys())

File “/home/appuser/venv/lib/python3.9/site-packages/gensim/models/keyedvectors.py”, line 734, in vocab

raise AttributeError(
AttributeError: The vocab attribute was removed from KeyedVector in Gensim 4.0.0.
Use KeyedVector’s .key_to_index dict, .index_to_key list, and methods .get_vecattr(key, attr) and .set_vecattr(key, attr, new_val) instead.

I have Error but I don’t know how to fix. “Previously, I have tried some methods.”
Note: On Jupyter Notebook, there is no such error.

Can anyone help me. Thanks for your help!!

Then make sure you install the same version of everything.

1 Like

Gensim == 3.8.0 fix error

Thank you for your reply

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.