You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But when I am trying to laod the model using the load() function, I get an AttributeError: Can't get attribute 'callback' on <module 'main' (built-in)>
However, for your infirmation, the model was trained on Bangla language corpora which contain unicode characters.
I tried reinstalling the package but the issue persists. I guess I am missing something important.
Gensim uses pickle to save models, and pickle stores functions as just names (references). The actual code is not stored. Your callback was a function named callback in the module __main__.
So when you did Word2Vec.load, Python tried to load your function by its name __main__.callback. That function in that module doesn't exist => you got an error.
To work around this, use properly named functions from importable modules, such as my_module.callback. Note that my_module has to be importable at the time you do Word2Vec.load.
Having said that, in the future Gensim will not serialize the callbacks at all. So this issue won't even come up. Closing as duplicate of #2136 – please continue there.
Problem description
I have trained a word2vec model using the following code
https://gist.github.com/AkibSadmanee/d946f14c397c317f938eeea66dca79dc
But when I am trying to laod the model using the load() function, I get an AttributeError: Can't get attribute 'callback' on <module 'main' (built-in)>
However, for your infirmation, the model was trained on Bangla language corpora which contain unicode characters.
I tried reinstalling the package but the issue persists. I guess I am missing something important.
The detailed error I am getting:
This is the package information of my installed version,
Name: gensim
Version: 3.8.3
Summary: Python framework for fast Vector Space Modelling
Home-page: http://radimrehurek.com/gensim
Author: Radim Rehurek
Author-email: [email protected]
License: LGPLv2.1
Location: c:\users\akibs\anaconda3\lib\site-packages
Requires: smart-open, scipy, numpy, Cython, six
Required-by:
Please provide the output of:
The text was updated successfully, but these errors were encountered: