PyTorch 2 · Training and saving

Schedule the learning rate

Reduce the learning rate over time. Call scheduler.step() once per epoch.

scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer, T_max=10)

Official PyTorch 2 documentation

More training and saving commands

All training and saving commands · PyTorch 2 cheatsheet

Was this page helpful?