I was using a older version of pytorch as I saved a resnet18 model with 2 neurons in classification using torch.save(model, ‘…/models/resnet.pth’). I was also able to load it back to memory by simply using torch.load (’…/models/resnet.pth’). Recently I upgraded my pytorch version and I am having issues when loading the model. The error is one as below
/home/uavws/anaconda3/lib/python3.6/site-packages/torch/serialization.py:316: SourceChangeWarning: source code of class ‘torchvision.models.resnet.ResNet’ has changed. you can retrieve the original source code by accessing the object’s source attribute or set torch.nn.Module.dump_patches = True
and use the patch tool to revert the changes.
warnings.warn(msg, SourceChangeWarning)
Traceback (most recent call last):
File “hgg_lgg_tsne_plot.py”, line 34, in
trained_model=torch.load(’/media/uavws/Varghese/pyt/resnet18/coronal_zscore_complete_network.pth’)
File “/home/uavws/anaconda3/lib/python3.6/site-packages/torch/serialization.py”, line 261, in load
return _load(f, map_location, pickle_module)
File “/home/uavws/anaconda3/lib/python3.6/site-packages/torch/serialization.py”, line 409, in _load
result = unpickler.load()
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 875: ordinal not in range(128)
Please help