Load a `pkl` model

Looking at Yunjey’s example here, the net is saved as a .pkl file. I have read on forums here with people trying to access models that are saved with .pth extension.

Does it count if they are saved as .pkl files? If it does, what is the correct way to load a saved net?

Also, is there a way to import a pytorch model into c++?

Hi! pkl is python pickled file according to this while pth is a saved pytorch tensor according to this.

When I saved the result as pkl, it doesn’t seem to be as the same result from training.

1 Like