-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unpickling models across python3 and python2 #853
Comments
The issue with unpickling a model pickled in python3 with python2.7 results from a bug in pickle which incorrectly maps The issue with unpickling a python2.7 model in python3 is because of encoding issues with numpy arrays - http://stackoverflow.com/questions/28218466/unpickling-a-python-2-object-with-python-3 |
Same question on the mailing list https://groups.google.com/d/msg/gensim/LNS8X84B0yE/B6PZKmDnBgAJ |
Strange that it is a different error to #860 |
The answer to this question is in Gensim FAQ |
That sounds good, I'll add a small section for word2vec too (right now, it mentions only LDA models) But this bug addresses loading models in Python 3, that were trained using Python 2. The other bug is loading models trained in Python 2, that were trained using Python 3. That results from a bug in versions of pickle pre-Python 3.5. It is fixable, but in case this isn't a common use case, we can possibly skip it. (and considering that I had to dig rather deep to uncover the bug and fix, I don't think a lot of people have faced this issue) |
Fixed in #1039 |
hi can i know the steps to solve this error..? |
there is hickle which is faster than pickle and easier. vec_x and vec_y are numpy arrays data=[vec_x,vec_y] Then you just read it and perform the operations data2 = hkl.load( 'new_data_file.hkl' ) |
Training and saving the model with python3 -
Loading it with python2.6 or 2.7 -
Raises this error -
This goes the other way around too (loading models saved with python2.7 in python3), although with a different error -
The text was updated successfully, but these errors were encountered: