Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when update new version of magpie #192

Open
bigredbug47 opened this issue Sep 26, 2019 · 3 comments
Open

Error when update new version of magpie #192

bigredbug47 opened this issue Sep 26, 2019 · 3 comments

Comments

@bigredbug47
Copy link

bigredbug47 commented Sep 26, 2019

Hi guys,

After updated the new version of magpie (v2.1), the old saved model, words vector that created in v2.0 seems can't be loaded in v2.1.

The errors were occurred by gensim library.

    predict_text = magpie.predict_from_text(trans_text)
File "/usr/local/lib/python3.5/dist-packages/magpie/main.py", line 196, in predict_from_text
    return self._predict(doc)
  File "/usr/local/lib/python3.5/dist-packages/magpie/main.py", line 214, in _predict
    word_vector = self.word2vec_model.wv[w].reshape(1, -1)
  File "/usr/local/lib/python3.5/dist-packages/gensim/models/keyedvectors.py", line 353, in __getitem__
    return self.get_vector(entities)
  File "/usr/local/lib/python3.5/dist-packages/gensim/models/keyedvectors.py", line 471, in get_vector
    return self.word_vec(word)
  File "/usr/local/lib/python3.5/dist-packages/gensim/models/keyedvectors.py", line 463, in word_vec
    result = self.vectors[self.vocab[word].index]
AttributeError: 'Word2VecKeyedVectors' object has no attribute 'vectors'

What should we do to load the saved model from v2.0 to use in v2.1?

Thanks for your help.

@jstypka
Copy link
Collaborator

jstypka commented Sep 27, 2019

@bigredbug47 hmmmm, that's interesting. It seems like gensim explodes when we look up a particular word. Does that also happen when you save and read vectors both through v2.1?

@bigredbug47
Copy link
Author

Nope @jstypka, it is normal when I save and load in the same version. But can't work when I use them in other version.

@jstypka
Copy link
Collaborator

jstypka commented Sep 30, 2019

We bumped Gensim version quite significantly in the update from v2.0 to v2.1. I didn't expect any issues, but it's highly likely that the vector spaces are incompatible between them. I'll add a note to README! Thanks! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants