Skip to content Skip to sidebar Skip to footer

Converting Word Vectors (from Fasttext) To Use In Spacy Fails

I generated word vectors with fastText and wanted to convert them to use in a spaCy model (for German). In the spaCy documentation it says that the vectors 'Should be a tab-separat

Solution 1:

I downloaded a fasttext model (wiki.el.vec) from fastText pretrained vectors and then used the following gensim code to convert them to txt format:

from gensim.models.keyedvectors import KeyedVectors
model = KeyedVectors.load_word2vec_format('wiki.el.vec', binary=False)
model.save_word2vec_format('wiki.el.txt', binary=False)

Then I run:

python3 -m spacy init-model el . --vectors-loc wiki.el.txt

And it worked fine.

Replace el with de and the initial wiki.el.vec file with a corresponding de.vec file and reproduce the steps I followed and I think it will get done.

Hope it helps!

Post a Comment for "Converting Word Vectors (from Fasttext) To Use In Spacy Fails"