Search⌘ K
AI Features

Model Training and Predictions

Explore how to instantiate a PyTorch model class, set loaders, and train models on CPU or GPU. Understand tracking epochs, examining losses, and making predictions with new data in PyTorch.

Starting steps

We start by instantiating the StepByStep class with the corresponding arguments. Next, we set its loaders using the appropriately named function set_loaders. Then, we set up an interface with TensorBoard, and then name our experiment “classy.”

Python 3.5
sbs = StepByStep(model, loss_fn, optimizer)
sbs.set_loaders(train_loader, val_loader)
sbs.set_tensorboard('classy')

One important thing to notice is that the model attribute of the sbs object is the same object as the model variable created in the model configuration. It is not a copy! We ...