epochs

Learn · Module 04 · Deep learning in PyTorch · Lesson 3 of 3

Using a trained model

Training is half the job. Running the model, saving it and moving it to a GPU have a few rules that trip people up.

3 minute read

In short
  • Use model.eval() and torch.no_grad() when predicting.
  • Save and load the state dict into the same model class.
  • Move the model and every batch to the same device.

This lesson is part of Pro

The first two lessons of every module are free. Pro opens every lesson and every project.

See Pro plansFrom ₹119 a month. No auto-renewal.