Hi it’s a small problem I am facing with respect to model saving and loading.
I am training a simple classification model in Google Colab. As per the instructions from https://pytorch.org/tutorials/recipes/recipes/saving_and_loading_models_for_inference.html
I am saving the model as
torch.save(net.cpu().state_dict(),"/folder/model.pt")
After this, I am downloading the saved file from colab. While trying to load it(ONLY FOR INFERENCE)in my local machine as
model = NetClass()
model.load_state_dict(torch.load("/local_folder/model.pt")
It does not load the model but returns an error as
RuntimeError: ./mymodel/model.pt is a zip archive (did you mean to use torch.jit.load()?)
I tried unzipping the downloaded file manually and it has a directory structure which is expected. Now I don’t know where to proceed.
I tried the same method in the same colab file itself and IT WORKED. But in local file it is NOT WORKING
Any kind of help and suggestions would be highly appreciated!
Thank you!