Unpickling Error while using Word2Vec.load()

2019-08-24 11:36发布

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条回答
放荡不羁爱自由
2楼-- · 2019-08-24 12:15

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?

查看更多
登录 后发表回答