What does .pth mean in torch.save?

example: https://github.com/pytorch/examples/blob/0984955bb8525452d1c0e4d14499756eae76755b/imagenet/main.py#L241

What is pth extension?
Just curious, thanks.

Don’t think it means anything in particular, it just seems to be a convention for files saved using torch.save(). Compare this to .pck, which is commonly used with Python’s built-in pickle.dump().

Personally I tend to use .dat data files to save and load models but as mentioned above .pth path files seem to be most prominent preference for saving models

1 Like

I use .pkl for pickle.dump, fine.
.dat looks good.

Hmm, I wonder where this convention came from? Being new to pytorch, it was a bit confusing because .pth files are already used in the context of python as files in site packages that point to other directories on the system.

1 Like