Python Engineer

Free Python and Machine Learning Tutorials

Become A Patron and get exclusive content! Get access to ML From Scratch notebooks, join a private Slack channel, get priority response, and more! I really appreciate the support!

PyTorch Lightning Tutorial - Lightweight PyTorch Wrapper For ML Researchers

18 Aug 2020

PyTorch Lightning is a lightweight PyTorch wrapper that helps you scale your models and write less boilerplate code. In this Tutorial we learn about this framework and how we can convert our PyTorch code to a Lightning code.

Lightning is nothing more than organized PyTorch code, so once you’ve organized it into a LightningModule, it automates most of the training for you.The beauty of Lightning is that it handles the details of when to validate, when to call .eval(), turning off gradients, detaching graphs, making sure you don’t enable shuffle for val, etc…

In this Tutorial we convert the code from the PyTorch beginner Course #13 to a Lightning code.

Code on GitHub: https://github.com/python-engineer/pytorch-examples.

Lightning Repo

https://github.com/PyTorchLightning/pytorch-lightning

Installation

conda install pytorch-lightning -c conda-forge or pip install pytorch-lightning