/pl-mnist

PyTorch Lightning for MNIST

Primary LanguageJupyter Notebook

Welcome to PyTorch Lightning Template 👋

Logo

PyTorch Lightning

The lightweight PyTorch wrapper for ML researchers. Scale your models. Write less boilerplate.

Version Documentation Twitter: mindbelowink

PyTorch Lightning template for MNIST Classification problem


What do I do ?

  • Add learning rate scheduler and logger
  • Add custom callback class
  • Add early stopping callback
  • Add Model Checkpoint
  • Add TensorBoard for visualisation metric
  • Show how to training, validation, testing, and inference the model

Refactoring your PyTorch code + benefits + full walk-through

Watch the video

What is it?

READ THIS QUICK START PAGE

Lightning is a way to organize your PyTorch code to decouple the science code from the engineering. It's more of a PyTorch style-guide than a framework.

In Lightning, you organize your code into 3 distinct categories:

  1. Research code (goes in the LightningModule).
  2. Engineering code (you delete, and is handled by the Trainer).
  3. Non-essential research code (logging, etc... this goes in Callbacks).

Here's an example of how to refactor your research code into a LightningModule.

PT to PL

The rest of the code is automated by the Trainer! PT to PL

What does lightning control for me?

Everything in Blue! This is how lightning separates the science (red) from engineering (blue).

Overview

Why do I want to use lightning?

Although your research/production project might start simple, once you add things like GPU AND TPU training, 16-bit precision, etc, you end up spending more time engineering than researching. Lightning automates AND rigorously tests those parts for you.

Install

pip install pytorch-lightning

Usage

pl_mnist.ipynb

Author

👤 Ruben Stefanus

Show your support

Give a ⭐️ if this project helped you!