Gensim: Dov2Vec: AttributeError: Can't get attribute 'EuclideanKeyedVectors'

Created on 2 Feb 2018  路  1Comment  路  Source: RaRe-Technologies/gensim

Hi,

I can't find anything related to my issue, so I'm posting it here. I trained a doc2vec model, then saved it using model.save("my.model"). It saved 4 files:

  • my.model
  • my.model.docvecs.doctag_syn0.npy
  • my.model.syn1neg.npy
  • my.model.wv.syn0.npy

I then try to load it, using d2v = gensim.models.Doc2Vec.load('my.model'), and it returns:

Traceback (most recent call last):
  File "lstm.py", line 41, in <module>
    d2v = gensim.models.Doc2Vec.load('my.model')
  File "/home/fiorinin/deeplearning/lib/python3.4/site-packages/gensim/models/word2vec.py", line 1412, in load
    model = super(Word2Vec, cls).load(*args, **kwargs)
  File "/home/fiorinin/deeplearning/lib/python3.4/site-packages/gensim/utils.py", line 276, in load
    obj = unpickle(fname)
  File "/home/fiorinin/deeplearning/lib/python3.4/site-packages/gensim/utils.py", line 938, in unpickle
    return _pickle.load(f, encoding='latin1')
AttributeError: Can't get attribute 'EuclideanKeyedVectors' on <module 'gensim.models.keyedvectors' from '/home/fiorinin/deeplearning/lib/python3.4/site-packages/gensim/models/keyedvectors.py'>

Any idea? Is it normal that it uses word2vec anyway - I assume this is a parent class?
I tried updating, just in case, but there's the same error. Also, note that the training was done on a different machine, accessing the same directory. Can it be an incompatibility maybe, and if so, how to solve it?

Thanks!

Most helpful comment

Forget it, looks like my issue is I can't upgrade gensim properly on the machine trying to load the model. That was a compatibility issue, the training machine using 3.2.0 and the loading machine using 2.3.0. It looked like it upgraded gensim, but it didn't. The training machine can load the model without issue, so I'm closing this. Sorry to bother.

>All comments

Forget it, looks like my issue is I can't upgrade gensim properly on the machine trying to load the model. That was a compatibility issue, the training machine using 3.2.0 and the loading machine using 2.3.0. It looked like it upgraded gensim, but it didn't. The training machine can load the model without issue, so I'm closing this. Sorry to bother.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

menshikh-iv picture menshikh-iv  路  3Comments

ahmedbhabbas picture ahmedbhabbas  路  4Comments

hhchen1105 picture hhchen1105  路  4Comments

sairampillai picture sairampillai  路  3Comments

Laubeee picture Laubeee  路  3Comments