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

cPickle.UnpicklingError: invalid load key, '?' With existing model epoch_3_100.pt #3

Closed
yichengwang125 opened this issue Feb 6, 2018 · 1 comment

Comments

@yichengwang125
Copy link

yichengwang125 commented Feb 6, 2018

>>> import torch
>>>torch.load('epochs/epoch_3_100.pt')
<open file 'epochs/epoch_3_100.pt', mode 'rb' at 0x7f7e3eb91e40>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/torch/serialization.py", line 231, in load
    return _load(f, map_location, pickle_module)
  File "/usr/local/lib/python2.7/dist-packages/torch/serialization.py", line 369, in _load
    magic_number = pickle_module.load(f)
cPickle.UnpicklingError: invalid load key, '?'.
>>>

I tried to use the existing model in epochs folder, but got the error
Thanks

@leftthomas
Copy link
Owner

@yichengwang125 first, you should use python3, second, if you load model with CPU, or another GPU device, then you should use map_location args, it will be used to remap location tags appearing in the file (keys), to ones that specify where to put the storages.

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