Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get attribute 'Word2VecKeyedVectors' on <module 'gensim.models.keyedvectors' >

I train and save a gensim word2vec model:

W2V_MODEL_FN = r"C:\Users\models\w2v.model"

model = Word2Vec(X, size=150, window=3, min_count=2, workers=10)
model.train(X, total_examples=len(X), epochs=50)
model.save(W2V_MODEL_FN)

And then:

w2v_model = Word2Vec.load(W2V_MODEL_FN)

On one enviroment it works perfectly but in another I get the error:

{AttributeError}Can't get attribute 'Word2VecKeyedVectors' on module 'gensim.models.keyedvectors' from 'C:\Users\Anaconda3_New\envs\ISP_env\lib\site-packages\gensim\models\keyedvectors.py'>

So I guess it might be a package version issue?

But I couldn't figure what it is. Any ideas?

Thanks!

like image 255
oren_isp Avatar asked Nov 08 '22 01:11

oren_isp


1 Answers

Thanks to @oren_jsp answer to question.

pip3 install --upgrade gensim --user

It solved my problem.

like image 157
Baran Barakcin Avatar answered Nov 13 '22 03:11

Baran Barakcin