0
我想導入從tensorflow創建的word vecters並在gensim中使用它。將tensorflow中的單詞向量導入gensim
有一種方法gensim.models.KeyedVectors.load_word2vec_format
所以通過以下恰好相同的方式嘗試這種方法Training wordvec in Tensorflow, importing to Gensim
實施例:
WORD0 -0.000737 -0.002106 0.001851
word1 -0.000878 -0.002106 0.002834
保存文件,然後用kwarg二進制LOAD =假:
model = Word2Vec.load_word2vec_format(filename, binary=False)
但錯誤,如
Traceback (most recent call last):
File "<pyshell#12>", line 1, in <module>
model=gensim.models.KeyedVectors.load_word2vec_format('test.w2v')
File "C:\Users\cbj\Anaconda3\lib\site-packages\gensim\models\keyedvectors.py", line 243, in load_word2vec_format
raise EOFError("unexpected end of input; is count incorrect or file otherwise damaged?")
EOFError: unexpected end of input; is count incorrect or file otherwise damaged?
提出
我怎樣才能解決這個問題?