Reputation: 442
I downloaded Wikipedia word vectors from here. I loaded the vectors with:
model_160 = KeyedVectors.load_word2vec_format(wiki_160_path, binary=False)
and then want to train them with:
model_160.train()
I get the error back:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-11-22a9f6312119> in <module>()
----> 1 model.train()
AttributeError: 'KeyedVectors' object has no attribute 'train'
My question is now: It seems like KeyedVectors has no train function, but I want to continue training the vectors on my personal sentences, instead of just using the Wikipedia vectors. How is this possible?
Thanks in advance, Jan
Upvotes: 4
Views: 2869
Reputation: 362
You can't use KeyedVectors for that. From the documentation:
Word vector storage and similarity look-ups.
The word vectors are considered read-only in this class.
And also:
The word vectors can also be instantiated from an existing file on disk in the word2vec C format as a KeyedVectors instance.
[...]
NOTE: It is impossible to continue training the vectors loaded from the C format because hidden weights, vocabulary frequency and the binary tree is missing.
Upvotes: 4