I am new to the Gensim package, and I am trying to get a little familiar with it. I am now trying to import an existing, trained model. I am following exactly the example from this video (this section starts at 5:30). When I run the code from that video I get an error:
Code:
from gensim.models import Word2Vec, KeyedVectors
import pandas as pd
import nltk
model = KeyedVectors.load_word2vec_format('GoogleNews-vectors-negative300.bin.gz', binary=True, limit=100000)
model.wv.most_similar('man')
Error:
Traceback (most recent call last):
File "C:....", line 7, in <module>
model.wv.most_similar('man')
AttributeError: 'KeyedVectors' object has no attribute 'wv'
In a previous example I also ran into a similar problem when training an own model (namely with the name of the size
parameter, which turned out to be changed to vector_size
, because the package is deprecated I read). That probably only happened quite recently, because in the comments of the YouTube video I do not read about such problems yet. And that fix about that size
parameter that was renamed was also from a post here on stackoverflow that is only 2 weeks old.
Does anyone know how I can still use this wv
attribute, so that I can just continue with the example from the video?