--- id: lightning version: "2.6.5" license: Apache-2.0 license_treatment: permissive maintenance: active --- # lightning — The Deep Learning framework to train, deploy, and ship AI products Lightning fast. License: permissive · Maintenance: active · Downloads: 6.4M/mo ## What it is and what it does Lightning is a training framework built on top of PyTorch that eliminates boilerplate infrastructure code. Instead of manually managing backpropagation, mixed precision, distributed training, and device placement across projects, you define your model as a LightningModule with training_step and configure_optimizers methods, then pass it to a Trainer that handles the rest. The framework scales from single CPU to thousands of GPUs across multiple nodes without changing your core model code. It sits between plain PyTorch (which requires you to write all infrastructure) and higher-level frameworks that hide model details. You retain full control over model logic while Lightning automates the engineering: logging, checkpointing, gradient accumulation, distributed synchronization, and hardware acceleration. It supports pretraining and finetuning workflows across diverse tasks—image classification, segmentation, text, audio, LLM finetuning, and time-series forecasting. Use it for: - Scale a single-GPU PyTorch model to multi-node training without rewriting training loops. - Pretrain or finetune large models (LLMs, diffusion models) with automatic mixed precision and distributed strategies. - Manage experiment tracking, checkpointing, and logging across multiple training runs. - Train on TPUs or other accelerators by changing one Trainer parameter instead of rewriting device logic. - Build reproducible research code that separates model definition from training infrastructure. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Lightning is a framework that organizes PyTorch code to automate distributed training infrastructure—handling backpropagation, mixed precision, multi-GPU, and multi-node setups—while keeping your model logic unchanged. Yes, if you train PyTorch models at any scale beyond single-GPU prototypes. Lightning eliminates repetitive distributed training boilerplate while keeping model code readable and portable. One known vulnerability (PYSEC-2026-3624) should be reviewed before production use, but the active maintenance status and permissive license make it a solid choice for research and production workflows. ## Install pip install lightning uv add lightning poetry add lightning ## Installing lightning Before you install: Low friction: pure Python wheel with 9 runtime dependencies including torch and torchmetrics. Actively maintained with recent releases; last commit 2026-08-09 and 31287 repository stars indicate ongoing development. License in practice: Apache-2.0 is permissive, allowing commercial use, modification, and distribution with minimal restrictions—suitable for most projects. Quickstart: pip install lightning import lightning as L import torch.nn as nn class LitModel(L.LightningModule): def __init__(self): super().__init__() self.layer = nn.Linear(10, 1) def training_step(self, batch, batch_idx): return self.layer(batch[0]).mean() def configure_optimizers(self): return torch.optim.Adam(self.parameters()) trainer = L.Trainer() trainer.fit(model, train_dataloader) Requires Python >=3.10 and torch as a runtime dependency; GPU training requires CUDA-compatible hardware and drivers. Verify before relying: - Scope and severity of PYSEC-2026-3624 vulnerability and whether it affects typical training workflows. - Whether the framework's abstraction overhead is acceptable for custom training loops requiring fine-grained control. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 6.4M/month (top 5,000 on PyPI) - Known vulnerabilities: 1 ## Tags pytorch training framework, distributed deep learning, multi-gpu training automation, pytorch lightning trainer, scale pytorch without code changes, deep learning infrastructure, pytorch model training framework, pytorch-training, distributed-computing, deep-learning [View on SkillFed](https://skillfed.io/packages/lightning) · [View on PyPI](https://pypi.org/project/lightning/)