Pytorch Training a Model Part 2

Stephen Blum · Beginner ·📐 ML Fundamentals ·1w ago

Key Takeaways

Trains a convolutional neural network model using PyTorch

Original Description

Today we wrap up part two of our full convolutional neural network build. We already have the model set up, so now we finish the training loop, try a few optimizers, and add some basic validation checks. We set epochs, loop over batches, move data and the model to the same device, run the forward pass, compute loss, call backward, then optimizer step, and track the loss so we can see it drop. If you are new here, an epoch just means the model has seen the whole training set once, then it can see it again for a second epoch. We also run validation every so often to check accuracy on data the model is not training on, and we saw it climb from about 5 percent untrained to around the low 80s after training, with a few dips that are normal. TensorBoard is in the tutorial, and even if it is not my favorite, it can help you see loss and accuracy over time. That is a solid end to end CNN run, and next week we start building real stuff with it.
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Related Reads

Up next
How to Train AI to Play Games ? How AI Learns to Play ? Several Methods EXPLAINED
MaxonShire
Watch →