Pytorch load模型出错:_pickle.UnpicklingError: invalid load key, ‘<‘.

torch.load时候报错:

Traceback (most recent call last):
  File ">", line 1, in >
  File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 795, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 1002, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '<'.

结论:模型文件损坏,检查模型大小(大概率没下载完整),重新(手动)下载。

你可能感兴趣的:(pytorch,python,深度学习)