A newbie question about .pth files

That most certainly means that this file was not saved using torch.save().
Using pickle (that torch.save/load uses), you can only reload a file the same way it was saved. In particular, this seems to indicate that your file was not saved using torch.save().

The thing is that .pth file is not a specific thing. It is just a python pickled object. Just that people usually use special extension like .pth or .pt to mean that it contains pytorch objects.

1 Like