Benchmark performance vs. vanilla PyTorch
masterPyTorch Reproducibility Guide to ensure results are consistent and reproducible.repository·master·Indexed 12 days ago
https://github.com/lightning-ai/pytorch-lightningA deep learning framework designed to pretrain and finetune AI models by automating PyTorch engineering boilerplate, such as distributed training and mixed precision. It includes the high-level Trainer class and Lightning Fabric for hardware orchestration, training management, and building custom training loops (BYOT).
PyTorch Reproducibility Guide to ensure results are consistent and reproducible.The lightning.fabric.plugins.collectives module provides experimental support for collectives within Lightning Fabric. This module contains the base abstractions and implementations for managing collective operations (like distributed communication) via plugins.
Warning: This is an experimental feature and its API may change in future versions.
PyTorch Lightning provides various workflows to customize and extend training for specific hardware, distributed strategies, or advanced research needs. Common tasks include:
Remote Filesystems documentation for specific provider configurations.For advanced users working with Lightning Fabric, several specialized workflows are available to optimize large-scale training and distributed operations:
gather, reduce, and broadcast for distributed operations.torch.compile to accelerate model execution on modern hardware.To train larger models more efficiently, you can utilize three primary optimization strategies in PyTorch Lightning:
torch.compile to speed up models on modern hardware.To manage complex PyTorch Lightning projects, you can follow three main architectural patterns:
LightningDataModule to encapsulate data loading, preprocessing, and splitting logic. This allows you to reuse the same dataset across different models.LightningModule and LightningDataModule from the command line, enabling easy experimentation without changing code.PyTorch Lightning provides a variety of examples demonstrating how to use Fabric for different machine learning tasks, ranging from basic classification to advanced large language model pretraining. These examples cover different complexity levels:
The intermediate curriculum for PyTorch Lightning focuses on scaling models and enabling collaborative development. Key learning paths include:
DataModules to enable dataset reusability.An Accelerator is the component that connects a Lightning Trainer to specific hardware, such as CPUs, GPUs, TPUs, HPUs, or MPS.
In the Lightning architecture, the Accelerator is a part of a Strategy. While the Strategy manages communication across multiple devices (distributed training), the Accelerator handles the low-level interaction with the hardware itself. Whenever the Trainer or training loops need to communicate with hardware, they call into the Strategy, which in turn calls into the Accelerator.