Facing issue: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 918: ordinal not in range(128) while trying to load a Pytorch model
I am trying to load a pre-trained Pytorch model but getting an error as shown below:
model = torch.load('a.pth')
  File &quot;/home/ubuntu/env/lib/python3.6/site-packages/torch/serialization.py&quot;, line 267, in load
    return _load(f, map_location, pickle_module)
  File &quot;/home/ubuntu/env/lib/python3.6/site-packages/torch/serialization.py&quot;, line 420, in _load
    result = unpickler.load()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 918: ordinal not in range(128)

I am using Python 3.6 in the virtual environment and PyTorch version = 0.3.1, any leads towards resolving the issue will be helpful.

From documentation:

By default, we decode byte strings as utf-8. This is to avoid a common error case UnicodeDecodeError: 'ascii' codec can't decode byte 0x... when loading files saved by Python 2 in Python 3. If this default is incorrect, you may use an extra encoding keyword argument to specify how these objects should be loaded, e.g., encoding='latin1' decodes them to strings using latin1 encoding, and encoding='bytes' keeps them as byte arrays which can be decoded later with byte_array.decode(...).

Try to change encoding, for instance:
model = torch.load('a.pth', encoding='latin')  # or 'ascii'

