简体   繁体   中英

Gensim: error while loading pretrained doc2vec model?

I'm loading pretrained Doc2Vec model using:

from gensim.models import Doc2Vec
model = Doc2Vec.load('/path/to/pretrained/model')

I'm getting the following error:

AttributeError: 'module' object has no attribute 'call_on_class_only'

Does anyone know how to fix it. The model was trained with gensim 0.13.3 and I'm using gensim 0.12.4.

Gensim will generally try to support loading of models saved from older versions into newer versions – but the reverse is a much harder problem, and will only work sometimes.

So upgrade the environment where you want to load the model to 0.13.3, to match where it was trained. (Or try the most-recent version, 1.0.1.) But don't try to move models backwards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM