Unpickling Error while using Word2Vec.load()

爱⌒轻易说出口 提交于 2020-01-07 03:58:57

问题


I am trying to load a binary file using gensim.Word2Vec.load(fname) but I get the error:

File "file.py", line 24, in model = gensim.models.Word2Vec.load('ammendment_vectors.model.bin')

File "/home/hp/anaconda3/lib/python3.6/site-packages/gensim/models/word2vec.py", line 1396, in load model = super(Word2Vec, cls).load(*args, **kwargs)

File "/home/hp/anaconda3/lib/python3.6/site-packages/gensim/utils.py", line 271, in load obj = unpickle(fname)

File "/home/hp/anaconda3/lib/python3.6/site-packages/gensim/utils.py", line 933, in unpickle return _pickle.load(f, encoding='latin1')

_pickle.UnpicklingError: could not find MARK

I googled but I am unable to figure out why this error is coming up. Please let me know if any other information is required.


回答1:


This would normally work, if the file was created by gensim's native .save().

Are you sure the file 'ammendment_vectors.model.bin' is complete and uncorrupted?

Was it created using the same Python/gensim versions as in use where you're trying to load() it?

Can you try re-creating the file?



来源:https://stackoverflow.com/questions/44022180/unpickling-error-while-using-word2vec-load

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