I would like to know the general way to read .pt file generated by pytorch, since I want to figure out how the data is organized and read the values so that I can make some modification on it and change the structure.
Could somebody tell me how to read that? Thank you so much.
You can take a look at this tutorial for more details on how saving and loading models in PyTorch are done.
The model’s state_dict is just a regular python dictionary once it is loaded. Maybe this thread can help you understand how to manipulate it, i.e., add/or change parameters, etc.
I still can not make sense of it
What do you mean? You can just use torch.load
.
Thanks. I want to use it in Django
Please don’t post pictures/screenshots. Post the actual code/error in text.
Seems like you just did pip install torch
which won’t work well on Windows. Follow the guidelines here: https://pytorch.org/get-started/locally/
PS: you probably want to use a fully packaged 64-bit version of Python, which you do not seem to be using right now (wheel
missing, 32-bit version). So e.g. this one.
Can models saved in .pt format be used to inference in python? I know that .pth files can be used, are .pt files used in the same way?
Thanks!