PyTorch Lightning
An open-source PyTorch training framework for your own CPUs and GPUs, with distributed training, mixed precision, and Apache 2.0 licensing.

PyTorch Lightning is a Python framework for researchers and developers pretraining or fine-tuning AI models. It handles recurring training infrastructure while leaving the model logic in your PyTorch code.
- Training automation: Let the framework handle backpropagation and mixed precision while keeping control over how your model learns.
- Hardware scaling: Move training from a CPU to multiple GPUs or machines without changing your core model code, with TPU support as well.
- Experiment management: Use checkpointing, early stopping, and experiment manager integrations to track training and retain model progress.
- Model export: Export trained models to ONNX or TorchScript for production use.
Lightning supports tasks such as classification, segmentation, and summarization as well as language model training. Its model classes remain PyTorch modules, so it fits projects that already use PyTorch.
The companion Lightning Fabric package provides lower-level control for custom training loops. Fabric supports CPUs, Apple Silicon and CUDA GPUs, and TPUs, with distributed strategies including DDP, FSDP, and DeepSpeed.
PyTorch Lightning is open source under Apache 2.0 and can run on your own hardware or cloud infrastructure. Lightning Cloud is a separate hosted service that supplies cloud GPUs, autoscaling, and monitoring; you don't need to use it to run the framework.