Difference between Fasttext .vec and .bin file

孤人 提交于 2021-02-06 09:45:11

问题


I recently downloaded fasttext pretrained model for english. I got two files:

  1. wiki.en.vec
  2. wiki.en.bin

I am not sure what is the difference between the two files?


回答1:


The .vec files contain only the aggregated word vectors, in plain-text. The .bin files in addition contain the model parameters, and crucially, the vectors for all the n-grams.

So if you want to encode words you did not train with using those n-grams (FastText's famous "subword information"), you need to find an API that can handle FastText .bin files (most only support the .vec files, however...).




回答2:


As the documentation says,

model.vec is a text file containing the word vectors, one per line. model.bin is a binary file containing the parameters of the model along with the dictionary and all hyper parameters.

In other words, .vec file format is the same as .txt file format, and you could use it in other applications (for example, to exchange data between your FastText model and your Word2Vec model since .vec file is similar to .txt file generated by Word2Vec). And the .bin file could be used if you want to continue training the vectors or to restart the optimization.



来源:https://stackoverflow.com/questions/47118678/difference-between-fasttext-vec-and-bin-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!