0

I created my own word vectors with fasttext like so:

model = fasttext.train_unsupervised("corp.txt", model = "skipgram") #train model
model.save_model("`my_model.bin`") #save model

I would now like to load a spacy model with my vectors. For this, I would have to run the following command to create a spacy model

python3 -m spacy init-model de model --vectors-loc some_file.vec

and then I should be able to load it like so:

nlp = spacy.load('model')

My problem is, that I need to feed the vectors and not the model into the command (some_file.vec) but I only have a my_model.bin file, containing the model. I know that I can get specific vectors from the model like so

print(model["test"])

and could loop over all words to get all vectors. But

  1. I dont know how the .vec file should look like and
  2. I'm sure there has to be a better way to approach this.

ANY help is greatly appreciated

dumbchild
  • 275
  • 4
  • 11

1 Answers1

1

I just realised, I just had to convert the .bin file into an .vec file. I didn't know that this was easy to do. The code posted here helped me

dumbchild
  • 275
  • 4
  • 11