Why are multiple model files created in gensim word2vec?

北城以北 提交于 2019-11-27 06:43:59

问题


When I try to create a word2vec model (skipgram with negative sampling) I received 3 files as output as follows.

word2vec (File)
word2vec.syn1nef.npy (NPY file)
word2vec.wv.syn0.npy (NPY file)

I am just worried why this happens as for my previous test examples in word2vec I only received one model(no npy files).

Please help me.


回答1:


Models with larger internal vector-arrays can't be saved via Python 'pickle' to a single file, so beyond a certain threshold, the gensim save() method will store subsidiary arrays in separate files, using the more-efficient raw format of numpy arrays (.npy format).

You still load() the model by just specifying the root model filename; when the subsidiary arrays are needed, the loading code will find the side files – as long as they're kept beside the root file. So when moving a model elsewhere, be sure to keep all files with the same root filename together.



来源:https://stackoverflow.com/questions/47173538/why-are-multiple-model-files-created-in-gensim-word2vec

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