Jarvis.Z
Jarvis.Z

Reputation: 1

module 'word2vec-google-news-300' has no attribute 'load_data'

I tried to use gensim.downloader to download word2vec-google-news-300, but my network isn't very reliable, so I downloaded word2vec-google-news-300.gz and __init__.py from github and put them into ~/gensim-data/word2vec-google-news-300/.

But when I use api.load("word2vec-google-news-300") to load this model, I received error like this:

AttributeError: module 'word2vec-google-news-300' has no attribute 'load_data'

My code:

import gensim.downloader as api
model = api.load("word2vec-google-news-300")

Upvotes: 0

Views: 1546

Answers (2)

Aniruddha Kalburgi
Aniruddha Kalburgi

Reputation: 393

I was facing the same issue on Ubuntu, I checked the access rights for .gz file in this directory and elevated the access rights for all users.

cd ~/gensim-data/<anyvectors-package> ls -al sudo chmod u+rwx <anyvectors-package.gz> Now, try loading vectors again. It worked for me.

Refer related GitHub issue thread and answer here

Upvotes: 1

Highway_To_Hell
Highway_To_Hell

Reputation: 11

Try this: Extract GoogleNews-vectors-negative300.bin from word2vec-google-news-300.gz

from gensim.models import KeyedVectors
from gensim.test.utils import datapath
wv_from_bin = KeyedVectors.load_word2vec_format(datapath(r"path to GoogleNews-vectors-negative300.bin"), binary=True)

Upvotes: 1

Related Questions