UnpicklingError: invalid load key, '\x0a'


I met a problem that I trained my model in the lab using a Linux machine, after saving the checkpoint I took it home to use my Windows machine to load it and I got an error:

File “C:\Users\Eddie\anaconda3\envs\Single\lib\site-packages\torch\serialization.py”, line 777, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)

UnpicklingError: invalid load key, ‘\x0a’.

Can anyone help me with this issue? I guess it might be the problem of pytorch version, on the Windows machine I installed the latest Pytorch v1.9.0 and cuda 11.3, but the Linux machine is like v1.8.1 or even older.

Thanks a lot!

Could you compare the file sizes on both machines and make sure that the file was properly copied?


Sorry I just saw it, it has been solved. My mistake, I did not copy the trained models properly, sorry about that.

Thank you very much!