Skip to content

PyTorch Lightning Tutorial - Lightweight PyTorch Wrapper For ML Researchers

In this Tutorial we learn about this framework and how we can convert our PyTorch code to a Lightning code.


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鈥檝e 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鈥檛 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/patrickloeber/pytorch-examples.

Lightning Repo

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

Installation

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

FREE VS Code / PyCharm Extensions I Use

鉁 Write cleaner code with Sourcery, instant refactoring suggestions: Link*

* This is an affiliate link. By clicking on it you will not have any additional costs. Instead, you will support my project. Thank you! 馃檹