title | tags | description | slideOptions | ||||
---|---|---|---|---|---|---|---|
Experiment management with lightning and tensorboard |
Talk, pytorch lightning, tensorboard |
Oceanix workshop. |
|
Pytorch lightning and tensorboard for better experiment management
Demonstrate how the right tools can make your life easier https://media.giphy.com/media/0qaV5zc6KBMxrnELxK/giphy.gif
Engineering vs Research : Spending time on what matters
- Infra (cpu, gpu, cluster)
- managing logs
- organizing code (software engineering)
- saving/loading models
Tracking and comparing results of different experiments
A demo is worth a thousand words
- Lightning code walkthrough
- Workshop exercises description
- To your keyboards
class MNISTModel(LightningModule):
def __init__(self):
super().__init__()
self.l1 = torch.nn.Linear(28 * 28, 10)
def forward(self, x):
return torch.relu(self.l1(x.view(x.size(0), -1)))
def training_step(self, batch, batch_nb):
x, y = batch
loss = F.cross_entropy(self(x), y)
return loss
def configure_optimizers(self):
return torch.optim.Adam(self.parameters(), lr=0.02)
# Init our model
mnist_model = MNISTModel()
# Init DataLoader from MNIST Dataset
train_ds = MNIST(PATH_DATASETS, train=True, download=True, transform=transforms.ToTensor())
train_loader = DataLoader(train_ds, batch_size=BATCH_SIZE)
# Initialize a trainer
trainer = Trainer(
max_epochs=3,
)
# Train the model
trainer.fit(mnist_model, train_loader)
The repo for the workshop:
https://github.com/quentinf00/lightning-tensorboard-workshop