Loading…
Glossary term
A saved snapshot of a model's weights at a point during training.
A checkpoint is a snapshot of a model's weights, and often the optimizer state, saved at a point in training. Long training runs save checkpoints regularly so a crash does not mean starting over.
Researchers also release checkpoints from different stages of training so others can study or continue from them.
Save and load a checkpoint
import torch
torch.save(model.state_dict(), "checkpoint.pt") # save
model.load_state_dict(torch.load("checkpoint.pt")) # resumeCheckpoints make training resumable and make it possible to pick the best version of a model.