Hi, all,
I know that .pth and .pkl are both used for the save format for pytorch serializing model. What are the difference for these two formats? Which one is better in terms of efficiency in loading and saving model?
Thanks!
Hi, all,
I know that .pth and .pkl are both used for the save format for pytorch serializing model. What are the difference for these two formats? Which one is better in terms of efficiency in loading and saving model?
Thanks!
Two ways:
PyTorch built-in serialization is a recommended approach, according to PyTorch documentation.
I don’t know what is difference in performance between these two. One thing I noticed is that “pth” files are compressed using tar compression algorithm, so they should take less space on disk.
Take the smaller one. I tested creating .pth
and .pkl
files and found out that .pth
can grow in size when you save the model more than once. To get the first type you use save()
and second you use export()
of the learner.