-
Notifications
You must be signed in to change notification settings - Fork 536
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
UnicodeDecodeError #25
Comments
No idea. maybe you could try useGPU = 1. Model is cached using python2.7. |
i met the same problem! Did you solve it? |
i use python 3.6, i think the version may be the key! |
Indeed, it is the pickle library in python which cannot correctly load the CNN model trained in python2.7 into python3.6. Please let me know if there is some good solution for that. |
yep, i just use virtualenv to create a pure environment for python2.7 and all is ok. |
I solved it with a small change in torch code in serialization.py lines 376-377 by adding the encoding there: I know it is not the cleanest solution, but it works :) To make it cleaner, it should be at least wrapped it by Try - Catch. But I do use Torch for this purpose only |
I solved in the same way as paffel did, and it works pretty well. |
Thanks @paffell for the trick.
This is for the |
Thanks @soravux for cleaning the solution. I started to use it as well :) |
Thanks @soravux, it works for me too. |
@soravux Thanks so much!!! it's work for me |
Summary: Addresses a common compatibility issue when loading Py2 checkpoints in Py3 regarding to bytes. E.g., [1] #5994, [2] CSAILVision/places365#25, [3] https://discuss.pytorch.org/t/how-to-load-a-saved-model-trained-on-pytorch-0-3-1-python-2-7-on-pyorch-1-0-python-3-7/31212 Pull Request resolved: #14743 Reviewed By: weiyangfb Differential Revision: D13350888 Pulled By: soumith fbshipit-source-id: 2df4e828a8b70509118a355307ca3ebe51e108f6
UnpicklingError: invalid load key, '\x5c'. Getting the same error.Can anyone help? |
_pickle.UnpicklingError: invalid load key, '\x04'. Getting the same error. Tried Soravux's method, still report error. |
will you please mention the line numbers and the file name. Thanks. |
您的邮件已收到,我会尽快回复,祝好!Your email has been received, I will reply as soon as possible!
|
The hack suggested in this issue, i.e., the following line:
completely breaks
To load models saved in Python2, since PyTorch 1.1.0 (released May 2019), do
|
您好,我是陆鑫益,您的邮件已经收到,我会尽快回复,谢谢。
|
Hi all! Running run_placesCNN_basic.py in this repository I run into this following error:
Traceback (most recent call last):
File "", line 4, in
File "/usr/local/lib/python3.5/dist-packages/torch/serialization.py", line 231, in load
return _load(f, map_location, pickle_module)
File "/usr/local/lib/python3.5/dist-packages/torch/serialization.py", line 379, in _load
result = unpickler.load()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 875: ordinal not in range(128)
Any advice? Thanks in advance!
The text was updated successfully, but these errors were encountered: