0
votes

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.

1
Have you redefined the variable Doc2Vec somewhere?kennytm
What do you mean by "redefined"? I use: import gensim from gensim.models import Doc2VecRegina
I mean, did you wrote Doc2Vec = ... somewhere before calling Doc2Vec.load?kennytm
No. I didn't redefinedRegina

1 Answers

2
votes

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.