'Doc2Vec' object has no attribute 'dv'

Viewed 51

I meet this problem When I load doc2vec model, the error is below.

I tried different versions (3.6.0/3.8.6/4.1.2) of gensim but all got the same result.

please help...

p.s. this code works when I run it in Colab, so the model should be fine.

from gensim.models.doc2vec import Doc2Vec, TaggedDocument
import jieba
import jieba.analyse

banana_model_d2v = Doc2Vec.load('banana_doc2vec.model') 
    ---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [20], in <cell line: 8>()
----> 8 banana_model_d2v = Doc2Vec.load('banana_doc2vec.model')

File ~/opt/anaconda3/lib/python3.9/site-packages/gensim/utils.py:1521, in deprecated.<locals>.decorator.<locals>.new_func1(*args, **kwargs)
   1514 @wraps(func)
   1515 def new_func1(*args, **kwargs):
   1516     warnings.warn(
   1517         fmt.format(name=func.__name__, reason=reason),
   1518         category=DeprecationWarning,
   1519         stacklevel=2
   1520     )
-> 1521     return func(*args, **kwargs)

File ~/opt/anaconda3/lib/python3.9/site-packages/gensim/models/doc2vec.py:326, in Doc2Vec.docvecs(self)
    323 @property
    324 @deprecated("The `docvecs` property has been renamed `dv`.")
    325 def docvecs(self):
--> 326     return self.dv

AttributeError: 'Doc2Vec' object has no attribute 'dv'
0 Answers
Related