Skip to content
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

Demo.py issue: 'ascii' codec can't decode byte 0xc3 in position 875 #28

Closed
ma-rv opened this issue Jul 6, 2018 · 3 comments
Closed

Comments

@ma-rv
Copy link

ma-rv commented Jul 6, 2018

Hey, trying to run the demo, I'm receiving the following error. Any suggestions on how to fix it? Thank you!

(base) D:\xx\Pose\src>python demo.py -demo images/h36m_1214.png
Traceback (most recent call last):
File "demo.py", line 31, in
main()
File "demo.py", line 15, in main
model = torch.load('hgreg-3d.pth').cuda()
File "C:\Users\xx\Anaconda3\lib\site-packages\torch\serialization.py", line 303, in load
return _load(f, map_location, pickle_module)
File "C:\Users\xx\Anaconda3\lib\site-packages\torch\serialization.py", line 469, in _load
result = unpickler.load()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 875: ordinal not in range(128)

@ma-rv ma-rv closed this as completed Jul 6, 2018
@DNALuo
Copy link

DNALuo commented Aug 1, 2018

HI, @Marv17 . I have the same problem. Would you mind saying how you solve the problem?

@ma-rv
Copy link
Author

ma-rv commented Aug 1, 2018

Hey, solved it by adding:

from functools import partial
import pickle

pickle.load = partial(pickle.load, encoding="latin1")
pickle.Unpickler = partial(pickle.Unpickler, encoding="latin1")

And changing model load to:

model = torch.load('hgreg-3d.pth', map_location=lambda storage, loc: storage, pickle_module=pickle)

@DNALuo
Copy link

DNALuo commented Aug 1, 2018

@Marv17 It solves the problem. Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants