Write a Minimal Training Loop
Loop over data and update weights.
From Steps to a Loop
You know the four moves of one iteration. Now you wrap them in a loop that walks over your data again and again until the model is trained. 🔁
Gather the Ingredients
Before looping you need three things: a model, a loss function, and an optimizer that holds your model's parameters. Set them up once, up front.
loss_fn = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters())All lessons in this course
- Forward Pass, Loss, Backward, Step
- Write a Minimal Training Loop
- Track Accuracy While You Train
- Train vs Eval Mode