Save and Load our Neural Network Model - Deep Learning with PyTorch 9

preview_player
Показать описание
In this video I'll show you how to save and load our Neural Network Model for our Iris Neural Network with PyTorch and Python.

We need to save the weights and biases in a state_dict dictionary.

Then I'll show you how to re-load that data and use it!

#pytorch #codemy #JohnElder

Timecodes

0:00​​ - Introduction
1:10 - Save The NN Model
1:58 - Load the Saved Model
2:50 - Make Sure It Worked with Eval()
3:33 - Conclusion
Рекомендации по теме
Комментарии
Автор

▶ Watch Deep Learning With Pytorch Playlist ✅ Subscribe To My YouTube Channel:
▶ See More At: ✅ Join My Facebook Group:
▶ Get The Code

Codemycom
Автор

I really love the simplicity with which you teach these. I had done my theories long back but it was so difficult to get some coding sessions and found yours to the save.

datacodedesign
Автор

finally got a neural network working, thanks

alexmarcellinus
Автор

So we wont be able the loss value same as the one we got while training 100 epochs?

Ragul_SL
Автор

The in_features and out_features are exactly the same as what we started with shouldn't they be different?

NormalCasinoWins
Автор

If anyone getting the " RuntimeError: expected scalar type Long but found Float", then change y labels to "LongTensor" instead of FloatTensor.

y_train = torch.LongTensor(y_train)
y_test = torch.LongTensor(y_test)

JayA-qslc
Автор

Is there a reason you save just the state of a model and not the entire model itself?
I was specifically thinking you could do:
torch.save(model, "Iris Model")
I felt like this could be more useful if you were bringing the model to another program but I was curious if there were any disadvantages to doing this?

Tacocat
Автор

I tried using pytorch to train a logistic regression model and the experience was 🥲🥲

pipi_delina