Building a Hello World MLP model
Welcome to the world of PyTorch Lightning!
Finally, it's time for us to build our first model using PyTorch Lightning. In this section, we will build a simple MLP model to accomplish the XOR
operator. This is like a Hello World introduction to the world of NNs as well as PyTorch Lightning. We will follow these steps to build our first XOR
operator:
- Importing libraries
- Preparing the data
- Configuring the model
- Training the model
- Loading the model
- Making predictions
Importing libraries
We begin by first importing the necessary libraries and printing their package versions, as follows:
import pytorch_lightning as pl import torch from torch import nn, optim from torch.autograd import Variable import pytorch_lightning as pl from pytorch_lightning.callbacks import ModelCheckpoint from torch.utils.data import DataLoader print("torch version:",torch.__version__) print("pytorch ligthening version...