Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load PreComputed Vectors Gensim

I am using the Gensim Python package to learn a neural language model, and I know that you can provide a training corpus to learn the model. However, there already exist many precomputed word vectors available in text format (e.g. http://www-nlp.stanford.edu/projects/glove/). Is there some way to initialize a Gensim Word2Vec model that just makes use of some precomputed vectors, rather than having to learn the vectors from scratch?

Thanks!

like image 871
MEric Avatar asked Sep 10 '25 09:09

MEric


1 Answers

The GloVe dump from the Stanford site is in a format that is little different from the word2vec format. You can convert the GloVe file into word2vec format using:

python -m gensim.scripts.glove2word2vec --input  glove.840B.300d.txt --output glove.840B.300d.w2vformat.txt
like image 155
Chaitanya Shivade Avatar answered Sep 13 '25 00:09

Chaitanya Shivade