Saving and Loading Methods
Explore how to implement save and load methods within PyTorch model classes to manage checkpoints effectively. Understand how to switch between training and evaluation modes while making predictions and learn to handle data conversion between NumPy arrays and PyTorch tensors seamlessly.
We'll cover the following...
We'll cover the following...
Saving and loading
Most of the code here is the same as the code we had in the chapter, Rethinking the Training Loop. The only difference is that we will be using the class attributes instead of the local variables.
The updated method for saving checkpoints should look like this now:
In addition, the loading checkpoint method should look like the following:
...
...