# What does .pth mean in torch.save?

**URL:** <https://discuss.pytorch.org/t/what-does-pth-mean-in-torch-save/4863>\
**Category:** Uncategorized\
**Created:** [July 13, 2017, 7:24pm UTC](https://discuss.pytorch.org/t/what-does-pth-mean-in-torch-save/4863 "2017-07-13T19:24:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![qbx2](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/qbx2/32/1715_2.png) [@qbx2](https://discuss.pytorch.org/u/qbx2)\
**Post date:** [July 13, 2017, 7:24pm UTC](https://discuss.pytorch.org/t/what-does-pth-mean-in-torch-save/4863/1 "2017-07-13T19:24:13Z")

</div>

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

What is pth extension?  
Just curious, thanks.

---

<div class="post-metadata">

**Author:** ![Kaixhin](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/kaixhin/32/647_2.png) [@Kaixhin](https://discuss.pytorch.org/u/Kaixhin)\
**Post date:** [July 13, 2017, 10:26pm UTC](https://discuss.pytorch.org/t/what-does-pth-mean-in-torch-save/4863/2 "2017-07-13T22:26:58Z")

</div>

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()`.

---

<div class="post-metadata">

**Author:** ![dgriff](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/dgriff/32/1361_2.png) [@dgriff](https://discuss.pytorch.org/u/dgriff)\
**Post date:** [July 13, 2017, 10:51pm UTC](https://discuss.pytorch.org/t/what-does-pth-mean-in-torch-save/4863/3 "2017-07-13T22:51:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![qbx2](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/qbx2/32/1715_2.png) [@qbx2](https://discuss.pytorch.org/u/qbx2)\
**Post date:** [July 14, 2017, 8:57am UTC](https://discuss.pytorch.org/t/what-does-pth-mean-in-torch-save/4863/4 "2017-07-14T08:57:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Allen\_Huang](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/a/b487fb/32.png) [@Allen\_Huang](https://discuss.pytorch.org/u/Allen_Huang)\
**Post date:** [September 13, 2017, 11:19pm UTC](https://discuss.pytorch.org/t/what-does-pth-mean-in-torch-save/4863/5 "2017-09-13T23:19:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marksisson](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/marksisson/32/59536_2.png) [@marksisson](https://discuss.pytorch.org/u/marksisson)\
**Post date:** [April 15, 2023, 11:27pm UTC](https://discuss.pytorch.org/t/what-does-pth-mean-in-torch-save/4863/6 "2023-04-15T23:27:54Z")

</div>

pth file extension represents the P,T, and H in “PyTorcH”
