Işıl Berfin Koparan
Işıl Berfin Koparan

Reputation: 39

Word2VecKeyedVectors' object has no attribute 'index_to_key'

I am trying to implement word2vec within nlpaug library and the following code :

aug = naw.WordEmbsAug(
    model_type='word2vec', model_path='GoogleNews-vectors-negative300.bin',
    action="insert")

gives me error of :

Word2VecKeyedVectors' object has no attribute 'index_to_key'

How can i fix such an issue ?

Upvotes: 2

Views: 6338

Answers (2)

Peter Scaife
Peter Scaife

Reputation: 31

I was running into this with gensim version 3.6, an upgrade to version 4.2 solved the problem.

Upvotes: 1

bsenst
bsenst

Reputation: 91

This is probably related to the version of gensim you use. You can print the version with:

import gensim
print(gensim.__version__)

Upvotes: 3

Related Questions