Fasttext .vec 和 .bin 文件之间的区别
Difference between Fasttext .vec and .bin file
我最近下载了英语的 fasttext 预训练模型。我有两个文件:
- wiki.en.vec
- wiki.en.bin
我不确定这两个文件有什么区别?
正如 documentation 所说,
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.
换句话说,.vec
文件格式与 .txt
文件格式相同,您可以在其他应用程序中使用它(例如,在 FastText 模型和 Word2Vec 之间交换数据模型,因为 .vec
文件类似于由 Word2Vec 生成的 .txt
文件)。如果您想继续训练向量或重新开始优化,可以使用 .bin
文件。
.vec
文件仅包含 plain-text 中的聚合词向量。 .bin
文件 此外 包含模型参数,而且至关重要的是,所有 n-grams 的向量。
因此,如果您想使用那些 n-grams(FastText 著名的 "subword information")对您没有训练过的单词进行编码,您需要找到一个API 可以处理 FastText .bin
文件(大多数只支持 .vec
文件,但是...)。
我最近下载了英语的 fasttext 预训练模型。我有两个文件:
- wiki.en.vec
- wiki.en.bin
我不确定这两个文件有什么区别?
正如 documentation 所说,
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.
换句话说,.vec
文件格式与 .txt
文件格式相同,您可以在其他应用程序中使用它(例如,在 FastText 模型和 Word2Vec 之间交换数据模型,因为 .vec
文件类似于由 Word2Vec 生成的 .txt
文件)。如果您想继续训练向量或重新开始优化,可以使用 .bin
文件。
.vec
文件仅包含 plain-text 中的聚合词向量。 .bin
文件 此外 包含模型参数,而且至关重要的是,所有 n-grams 的向量。
因此,如果您想使用那些 n-grams(FastText 著名的 "subword information")对您没有训练过的单词进行编码,您需要找到一个API 可以处理 FastText .bin
文件(大多数只支持 .vec
文件,但是...)。