File “/opt/conda/lib/python3.6/site-packages/torchvision/models/resnet.py”, line 217, in _resnet
progress=progress)
File “/opt/conda/lib/python3.6/site-packages/torch/hub.py”, line 499, in load_state_dict_from_url
return torch.load(cached_file, map_location=map_location)
File “/opt/conda/lib/python3.6/site-packages/torch/serialization.py”, line 426, in load
return _load(f, map_location, pickle_module, **pickle_load_args)
File “/opt/conda/lib/python3.6/site-packages/torch/serialization.py”, line 603, in _load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: unpickling stack underflow
thank you for suggest!  this deals my problem
the main reason is “e.g. if the pretrain model downloaded file is corrupt.”
step1: vim the last error file “/opt/conda/lib/python3.6/site-packages/torch/serialization.py”
step2: find the error code line,and add “print(”#####", f)" before the error line.
step3: run your code again, then remove the wrong pretrain file “ rm /root/.cache/torch/checkpoints/resnet152-b121ed2d.pth”