skillfed

lightning

The Deep Learning framework to train, deploy, and ship AI products Lightning fast.

lightning v2.6.5 6.4M downloads/30d#1,919 on PyPI31,287
Permissive license Apache-2.0 Active released

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 on this page — 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

lightning on PyPI

pip

pip install lightning

uv

uv add lightning

poetry

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 the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 9 — PyYAML, fsspec, lightning-utilities, packaging, torch, torchmetrics, tqdm, typing-extensions, pytorch-lightning
Maintenance actively maintained — 79 days since the last release
Last repo commit
First released
Downloads 6,376,248/month — #1,919 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities 1 — PYSEC-2026-3624

Evidence: lightning-2.6.5-py3-none-any.whl

Keywords: deep learning, pytorch, AI

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: Information Analysis

Tags

pytorch training frameworkdistributed deep learningmulti-gpu training automationpytorch lightning trainerscale pytorch without code changesdeep learning infrastructurepytorch model training framework
pytorch-trainingdistributed-computingdeep-learning

More Artificial Intelligence packages