pytorch-tutorial icon indicating copy to clipboard operation
pytorch-tutorial copied to clipboard

_pickle.UnpicklingError: invalid load key, '\x00'.

Open Anandktr opened this issue 7 years ago • 5 comments

Hi all! while running sample.py, this error comes up Traceback (most recent call last): File "sample.py", line 85, in main(args) File "sample.py", line 47, in main encoder.load_state_dict(torch.load(args.encoder_path)) File "C:\Anaconda3\lib\site-packages\torch\serialization.py", line 358, in load return _load(f, map_location, pickle_module) File "C:\Anaconda3\lib\site-packages\torch\serialization.py", line 532, in _load magic_number = pickle_module.load(f) _pickle.UnpicklingError: invalid load key, '\x00'.

Any solution for this..?

Anandktr avatar Sep 22 '18 13:09 Anandktr

I got the same error. Please help me out. Thanks in advance :)

anjalinagel12 avatar Mar 05 '19 14:03 anjalinagel12

Try using torch.load instead of pickle.load.

Anirudh257 avatar Jun 12 '19 09:06 Anirudh257

I am getting the exact same error regardless of if I use pickle.load or torch.load. Any help would be appreciated.

UnpicklingError: invalid load key, '\x00'.

dmichaels713 avatar Jul 29 '19 02:07 dmichaels713

@dmichaels713 Can you post more information like the PyTorch version, Python version, etc being used by you?

Anirudh257 avatar Jul 29 '19 18:07 Anirudh257

I am facing the same problem, could one of you guys come with a solution? That would be really helpful for me.

AslantheAslan avatar Dec 06 '21 07:12 AslantheAslan