PyTorch Tutorial 17 - Saving and Loading Models

preview_player
Показать описание
New Tutorial series about Deep Learning with PyTorch!

In this part we will learn how to save and load our model. I will show you the different functions you have to remember, and the different ways of saving our model. I also show you what you must consider when using a GPU.

Functions you must know:

Part 17: Saving and Loading Models

📚 Get my FREE NumPy Handbook:

📓 Notebooks available on Patreon:

If you enjoyed this video, please subscribe to the channel!

Official website:

Part 01:

Further Readings:

Code for this tutorial series:

You can find me here:

#Python #DeepLearning #Pytorch

----------------------------------------------------------------------------------------------------------
* This is a sponsored link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you so much for the support! 🙏
Рекомендации по теме
Комментарии
Автор

This is the best pytorch series I have come across. examples get right to the gist of lesson.

orjihvy
Автор

There are a couple of mistakes at around 14:30. You are using the state from the 'checkpoint' variable, where I think you should be using state from the 'loaded_checkpoint' variable. In general, I think this part of the tutorial would be clearer if you'd used two files, one for saving and one for loading. Also, a better IDE would highlight unused variables which might have helped avoid this mistake.

npomfret
Автор

Excellent and very useful, I finished all 17 tutorials, theank you

chiruk
Автор

thank you for the clear lesson! Really useful!

inesylla
Автор

Mr. Python Engineer does a good job, moves along at a reasonable speed.

geoffreyexoo
Автор

Great series! it will be great if you can add more pytorch videos :)

prajganesh
Автор

Thank You so much for this tutorial series

bijjalanaganithin
Автор

Like always beautiful video, I am giving your videos to all the beginners out there :-)

sarahjamal
Автор

In 15min, lines 32 and 32 should change to and "optimizer.load_state_dict(checkpoint["optim_state"]), respectively.

christinagiannoula
Автор

Thank you so much for making the wonderful tutorial!
Would you like to correct again the part load checkpoint. I thought the command in line 32 33 should be
and

nguyenduydatnguyenduydat
Автор

Amazing video, can i confirm that by using this method we can do fine tuning, for example train our model on one dataset, then save and load the model (with the weights), we can then train on a similar dataset but using the loaded model with the saved weights, right?

MuhammadHussain-wsxs
Автор

Hi I love your videos and it has been very much help for me.
I have a question that how can we use pytorch custom models on different files

mohammadusamah
Автор

Thanks for the great video!
I have a question at 14:56, when you print the loaded optimizer.state_dict(), the lr is loaded correctly, but the 'params' are not the same. What do 'params' of the optimizer mean? If I have saved checkpoint at epoch 100 and want to resume training by loading checkpoint, does the inconformity of params influence my training?

erictian
Автор

Thank you so much for your lecture! I tried to save all my testing model result with nii(image) format. Could you give me a tip for me? I saved and loaded model to test. I did the image segmentation, my goal is to get a predicted segmentation images.

mywayluna
Автор

Every pytorch video: "and you can ignore this warning right here" :P I am going to be first to fall into that trap. Great series! Thank you so much.

amerel-samman
Автор

I need your help on how I can resolve below issues:
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with to map your storages to the CPU.

annemahoro
Автор

Great series, thanks for your work. Could you cover topic of NN for non-linear regression tasks with PyTorch?

mdXX
Автор

Hi, thank you for showing all the methods. I have a federated learning use-case where I train a single model using 32 clients. Currently, I have CUDA Out of memory issue. I want to know how each of the methods presented here affect the memory allocation and reservation on a single GPU. Any comment/idea is appreciate. Many thanks.

longdang
Автор

could you make video about semantic segmentation with ensemble model with different encoders on pytorch, thank you!

Sparklerated
Автор

Nice Explanation!! I trained my model on GPU and saved but when loaded my .pt file using CPU, got an error?
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0, and CPU!
What should I do in this case?

Thank you

tehreemsyed