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’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/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*


PySaaS: The Pure Python SaaS Starter Kit

🚀 Build a software business faster with pure Python: Link*

* These are affiliate link. By clicking on it you will not have any additional costs. Instead, you will support my project. Thank you! 🙏