🐛 Description
(A clear and concise description of what the bug is.)
It will raise the error "_pickle.UnpicklingError: could not find MARK" if I call "I2V"program.
Error Message
(Paste the complete error message. Please also include stack trace by setting environment variable DMLC_LOG_STACK_TRACE_DEPTH=100
before running your script.)
Traceback (most recent call last):
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/doc2vec.py", line 857, in load
return super(Doc2Vec, cls).load(*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/base_any2vec.py", line 1230, in load
model = super(BaseWordEmbeddingsModel, cls).load(*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/base_any2vec.py", line 602, in load
return super(BaseAny2VecModel, cls).load(fname_or_handle, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/utils.py", line 436, in load
obj._load_specials(fname, mmap, compress, subname)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/utils.py", line 481, in _load_specials
setattr(self, attrib, val)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/utils.py", line 1461, in new_func1
return func(*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/base_any2vec.py", line 791, in syn1neg
self.trainables.syn1neg = value
AttributeError: 'Doc2Vec' object has no attribute 'trainables'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/bmk/8.3test/test.py", line 17, in
ll=get_pretrained_i2v("d2v_sci_256", model_dir="./data")
File "/home/bmk/anaconda3/lib/python3.8/site-packages/EduNLP-0.0.5-py3.8.egg/EduNLP/I2V/i2v.py", line 122, in get_pretrained_i2v
return _class.from_pretrained(*params, model_dir=model_dir)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/EduNLP-0.0.5-py3.8.egg/EduNLP/I2V/i2v.py", line 93, in from_pretrained
return cls("text", name, pretrained_t2v=True, model_dir=model_dir)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/EduNLP-0.0.5-py3.8.egg/EduNLP/I2V/i2v.py", line 35, in init
self.t2v = get_t2v_pretrained_model(t2v, kwargs.get("model_dir", MODEL_DIR))
File "/home/bmk/anaconda3/lib/python3.8/site-packages/EduNLP-0.0.5-py3.8.egg/EduNLP/Vector/t2v.py", line 57, in get_pretrained_t2v
return T2V(model_name, model_path, *args)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/EduNLP-0.0.5-py3.8.egg/EduNLP/Vector/t2v.py", line 29, in init
self.i2v: Vector = MODELS[model](*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/EduNLP-0.0.5-py3.8.egg/EduNLP/Vector/gensim_vec.py", line 118, in init
self.d2v = Doc2Vec.load(filepath)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/doc2vec.py", line 861, in load
return load_old_doc2vec(*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/deprecated/doc2vec.py", line 91, in load_old_doc2vec
old_model = Doc2Vec.load(*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/deprecated/word2vec.py", line 1617, in load
model = super(Word2Vec, cls).load(*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/deprecated/old_saveload.py", line 87, in load
obj = unpickle(fname)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/deprecated/old_saveload.py", line 379, in unpickle
return _pickle.loads(file_bytes, encoding='latin1')
_pickle.UnpicklingError: could not find MARK
(base) [bmk@sis10 8.3test]$ /home/bmk/anaconda3/bin/python /home/bmk/8.3test/test.py
EduNLP, INFO Use pretrained t2v model d2v_sci_256
downloader, INFO http://base.ustc.edu.cn/data/model_zoo/EduNLP/d2v/general_science_256.zip is saved as data/general_science_256.zip
downloader, INFO file existed, skipped
Traceback (most recent call last):
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/doc2vec.py", line 857, in load
return super(Doc2Vec, cls).load(*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/base_any2vec.py", line 1230, in load
model = super(BaseWordEmbeddingsModel, cls).load(*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/base_any2vec.py", line 602, in load
return super(BaseAny2VecModel, cls).load(fname_or_handle, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/utils.py", line 436, in load
obj._load_specials(fname, mmap, compress, subname)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/utils.py", line 481, in _load_specials
setattr(self, attrib, val)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/utils.py", line 1461, in new_func1
return func(*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/base_any2vec.py", line 791, in syn1neg
self.trainables.syn1neg = value
AttributeError: 'Doc2Vec' object has no attribute 'trainables'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/bmk/8.3test/test.py", line 17, in
ll=get_pretrained_i2v("d2v_sci_256", model_dir="./data")
File "/home/bmk/anaconda3/lib/python3.8/site-packages/EduNLP-0.0.5-py3.8.egg/EduNLP/I2V/i2v.py", line 122, in get_pretrained_i2v
return _class.from_pretrained(*params, model_dir=model_dir)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/EduNLP-0.0.5-py3.8.egg/EduNLP/I2V/i2v.py", line 93, in from_pretrained
return cls("text", name, pretrained_t2v=True, model_dir=model_dir)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/EduNLP-0.0.5-py3.8.egg/EduNLP/I2V/i2v.py", line 35, in init
self.t2v = get_t2v_pretrained_model(t2v, kwargs.get("model_dir", MODEL_DIR))
File "/home/bmk/anaconda3/lib/python3.8/site-packages/EduNLP-0.0.5-py3.8.egg/EduNLP/Vector/t2v.py", line 57, in get_pretrained_t2v
return T2V(model_name, model_path, *args)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/EduNLP-0.0.5-py3.8.egg/EduNLP/Vector/t2v.py", line 29, in init
self.i2v: Vector = MODELS[model](*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/EduNLP-0.0.5-py3.8.egg/EduNLP/Vector/gensim_vec.py", line 118, in init
self.d2v = Doc2Vec.load(filepath)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/doc2vec.py", line 861, in load
return load_old_doc2vec(*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/deprecated/doc2vec.py", line 91, in load_old_doc2vec
old_model = Doc2Vec.load(*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/deprecated/word2vec.py", line 1617, in load
model = super(Word2Vec, cls).load(*args, **kwargs)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/deprecated/old_saveload.py", line 87, in load
obj = unpickle(fname)
File "/home/bmk/anaconda3/lib/python3.8/site-packages/gensim/models/deprecated/old_saveload.py", line 379, in unpickle
return _pickle.loads(file_bytes, encoding='latin1')
_pickle.UnpicklingError: could not find MARK
To Reproduce
(If you developed your own code, please provide a short script that reproduces the error. For existing examples, please provide link.)
Steps to reproduce
(Paste the commands you ran that produced the error.)
1.M=get_pretrained_i2v("d2v_sci_256", model_dir="./data")
2.X=I2V("text","d2v",filepath='/home/bmk/8.3test/test/model/general_science_256.bin')
What have you tried to solve it?
Using a different version python, such as python3.6.8 in centos.
Environment
Environment Information
Operating System: ...
Linux
Python Version: (e.g., python3.6, anaconda/python3.7, venv/python3.8)
python 3.85 64-bit('base':conda)
Additional context