What does 'pth.tar' extension mean?

In some projects, they called torch.save and torch.load with ‘pth.tar’ extension.
I think ‘pth’ is for ‘PyTorcH’, but what is ‘tar’ for…?

Actually I had tried to open ‘pth.tar’ files with Archive Manager and failed :frowning:

Just for curious.
Thanks in advance.

1 Like

.tar refers to tarball and is an archive file.
As far as I know, the legacy serialization module used tarfile.

You can find more information about this file format in the Wikipedia article.

3 Likes

To add some advice you didn’t ask for: I’d recommend to just use .pt as the extension.
As you rightly note it’s been long ago that this used to be a tar file, and pth isn’t particularly compatible with Python’s “.pth” path files (there is an open issue to standardize on .pt in the PyTorch examples).

Best regards

Thomas

5 Likes

Thanks for your replies.

I agree, since it doesn’t seem like we actually need to tar/untar files when we use Pytorch’s save and load_state_dict functions. Hence, it’s just unnecessary overhead to explicitly write out the tar