How to save model weights to local machine from colab?

hi guys,
i train my model for image classifier of flower dataset on colab -because it will take long time on my local machine- using pretrained model vgg19 and after train i want to save my model weights on my local machine how can i do that ?

i found this but i can’t reuse for pytorch

you can reuse the same solution for pytorch. there’s nothing about the solution that makes it specific to another framework. (you are just saving a file in a particular folder)

how can i edit this part to be proper for .pth

model_json = model.to_json()
with open("drive/app/model.json", "w") as json_file:
# serialize weights to HDF5
print("Saved model to drive")

replace that entire snippet with:, 'drive/app/model.pth')

thanks very much it works :+1: