What does .pth mean in torch.save?

(SunYeop Lee) #1

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

What is pth extension?
Just curious, thanks.

(Kai Arulkumaran) #2

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

(SunYeop Lee) #4

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

(Allen Huang) #5

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.