Skip to content
New issue

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

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

Already on GitHub? # to your account

Why i can't load model on Python 3.6 version? #1970

Closed
simongeek opened this issue Mar 10, 2018 · 15 comments
Closed

Why i can't load model on Python 3.6 version? #1970

simongeek opened this issue Mar 10, 2018 · 15 comments
Labels
need info Not enough information for reproduce an issue, need more info from author

Comments

@simongeek
Copy link

simongeek commented Mar 10, 2018

I have problem with loading model on Python 3.6 version:

Traceback (most recent call last):
File "/Users/szymon/anaconda3/lib/python3.6/site-packages/gensim/models/word2vec.py", line 975, in load
return super(Word2Vec, cls).load(*args, **kwargs)
File "/Users/szymon/anaconda3/lib/python3.6/site-packages/gensim/models/base_any2vec.py", line 629, in load
model = super(BaseWordEmbeddingsModel, cls).load(*args, **kwargs)
File "/Users/szymon/anaconda3/lib/python3.6/site-packages/gensim/models/base_any2vec.py", line 278, in load
return super(BaseAny2VecModel, cls).load(fname_or_handle, **kwargs)
File "/Users/szymon/anaconda3/lib/python3.6/site-packages/gensim/utils.py", line 426, in load
obj._load_specials(fname, mmap, compress, subname)
File "/Users/szymon/anaconda3/lib/python3.6/site-packages/gensim/utils.py", line 469, in _load_specials
setattr(self, attrib, val)
File "/Users/szymon/anaconda3/lib/python3.6/site-packages/gensim/utils.py", line 1398, in new_func1
return func(*args, **kwargs)
File "/Users/szymon/anaconda3/lib/python3.6/site-packages/gensim/models/base_any2vec.py", line 380, in syn1neg
self.trainables.syn1neg = value
AttributeError: 'Word2Vec' object has no attribute 'trainables'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/szymon/PycharmProjects/sentimentpl/workingLSTM.py", line 57, in
word2vec_model = Word2Vec.load('w2v_allwiki_nkjpfull_50.model')
File "/Users/szymon/anaconda3/lib/python3.6/site-packages/gensim/models/word2vec.py", line 979, in load
return load_old_word2vec(*args, **kwargs)
File "/Users/szymon/anaconda3/lib/python3.6/site-packages/gensim/models/deprecated/word2vec.py", line 195, in load_old_word2vec
new_model.min_alpha_yet_reached = old_model.min_alpha_yet_reached
AttributeError: 'Word2Vec' object has no attribute 'min_alpha_yet_reached'

On Python 3.5 it's all correct.

@menshikh-iv
Copy link
Contributor

menshikh-iv commented Mar 10, 2018

Hello @simongeek,

  1. What's Gensim version was used for training?
  2. What's a current Gensim version?
  3. Please share your model (very important for reproducing your error)
  4. What's a python and OS?

@menshikh-iv menshikh-iv added the need info Not enough information for reproduce an issue, need more info from author label Mar 10, 2018
@gilgarad
Copy link

I had a similar problem like this;
it seems like the version of python and gensim generated the model must be same as the one that is trying to access the model... Did you check them?

@menshikh-iv
Copy link
Contributor

Hello @gilgarad,
can you give me needed information for reproducing the error #1970 (comment)

@gilgarad
Copy link

I solved it by making them using all same version

@narrowsnap
Copy link

I meet the same problem.
I used gensim version 3.4.0, python version 3.5.2

@menshikh-iv
Copy link
Contributor

@narrowsnap maybe you'll give me needed information #1970 (comment)?

@ljygod
Copy link

ljygod commented Mar 26, 2018

I also encountered the same problem. Did you solve it?

@menshikh-iv
Copy link
Contributor

Hello @li-jy, we would like to fix it as soon as possible, but we can't reproduce an error now (not enough information), please share information suggested in #1970 (comment) with us

@menshikh-iv
Copy link
Contributor

continued in #2000

@zhangjiantong
Copy link

window 64,python3.6,gensim 3.40 aslo have the same problem.

new_model.min_alpha_yet_reached = old_model.min_alpha_yet_reached

AttributeError: 'Word2Vec' object has no attribute 'min_alpha_yet_reached'

@menshikh-iv
Copy link
Contributor

@zhangjiantong this was resolved in #2012 and will be available in next release 3.5.0 (or you can install gensim from current develop branch now).

@gilgtc
Copy link

gilgtc commented May 15, 2018

@menshikh-iv I attempted to install gensim 3.5.0 from develop branch but it is still 3.4.0

I used the following, is that correct?

pip3 install git+https://github.com/piskvorky/gensim.git@develop

@andyhappy1
Copy link

i am running python 3.6 ...i have gensim 3.4 ...did
pip3 install git+https://github.com/piskvorky/gensim.git#develop
under my active venv
it successfully rebuilt.
I still get

from gensim.models.phraser import Phrases ModuleNotFoundError: No module named 'gensim.models.phraser'

@andyhappy1
Copy link

Oh, i switched up Phrases with phraser.

It should be:
from gensim.models.phrases import Phraser...now it's running. thx

@menshikh-iv
Copy link
Contributor

@gilgtc yes, that's correct (because of __version__ "bump" in the repository happens in release time)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
need info Not enough information for reproduce an issue, need more info from author
Projects
None yet
Development

No branches or pull requests

8 participants