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

AttributeError: 'Word2Vec' object has no attribute 'vector_size' #2015

Closed
dvaosta opened this issue Apr 4, 2018 · 2 comments
Closed

AttributeError: 'Word2Vec' object has no attribute 'vector_size' #2015

dvaosta opened this issue Apr 4, 2018 · 2 comments

Comments

@dvaosta
Copy link

dvaosta commented Apr 4, 2018

Description

I'm trying to load an already trained word2vec model downloaded from here by using the following code, as suggested by the aforementioned website:
from gensim.models import Word2Vec model=Word2Vec.load('wiki_iter=5_algorithm=skipgram_window=10_size=300_neg-samples=10.m')
When I try to execute that code, I get the following error:
UserWarning: detected Windows; aliasing chunkize to chunkize_serial warnings.warn("detected Windows; aliasing chunkize to chunkize_serial") Traceback (most recent call last): File "d:\DavideV\documents\visual studio 2017\Projects\tesi\tesi\tesi.py", line 112, in <module> model=Word2Vec.load('wiki_iter=5_algorithm=skipgram_window=10_size=300_neg-samples=10.m') File "C:\Users\admin\Anaconda3\lib\site-packages\gensim\models\word2vec.py", line 979, in load return load_old_word2vec(*args, **kwargs) File "C:\Users\admin\Anaconda3\lib\site-packages\gensim\models\deprecated\word2vec.py", line 155, in load_old_word2vec 'size': old_model.vector_size, AttributeError: 'Word2Vec' object has no attribute 'vector_size'
I suppose that this is due to the fact that the model has probably been trained with a previous version of gensim, but I would prefer to avoid to retrain it.

Versions

Windows-10-10.0.16299-SP0
Python 3.6.3 |Anaconda, Inc.| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)]
gensim 3.4.0

@manneshiva
Copy link
Contributor

manneshiva commented Apr 4, 2018

@dvaosta Thanks for the report. This is a known issue and is addressed in #2012. The PR addresses your issue so you can try using the code from the PR. It should solve your issue. The fix will be merged soon.

@dvaosta
Copy link
Author

dvaosta commented Apr 4, 2018

Ok, now it works. 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