skillfed

pytorch-lightning

PyTorch Lightning is the lightweight PyTorch wrapper for ML researchers. Scale your models. Write less boilerplate.

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

What it is and what it does

PyTorch Lightning is a structured wrapper around PyTorch that enforces separation of research code (the LightningModule), engineering code (handled by the Trainer), and auxiliary concerns like logging and callbacks. It lets you write a model once and then scale it to multiple GPUs, TPUs, or CPUs by changing only Trainer configuration—no changes to your model code required. The package handles distributed training setup, mixed-precision training, checkpointing, early stopping, and integration with experiment loggers (TensorBoard, Weights & Biases, MLflow, and others) automatically.

The design philosophy is to eliminate boilerplate: you define training_step, validation_step, and configure_optimizers in your LightningModule, organize data into DataLoaders or a LightningDataModule, and let the Trainer orchestrate the rest. It's built on top of torch, tqdm, PyYAML, fsspec, torchmetrics, packaging, typing-extensions, and lightning-utilities, all of which are standard dependencies in the PyTorch ecosystem. The package is actively maintained, has no known vulnerabilities, and supports Python 3.10 through 3.13.

Use it for:

  • Train a model on a single GPU, then scale to 8 GPUs or 256 GPUs across multiple nodes without modifying model code.
  • Manage experiment tracking and logging across multiple runs with built-in logger integrations.
  • Implement early stopping and model checkpointing with minimal boilerplate code.
  • Export trained models to TorchScript or ONNX for production inference.
  • Run the same training code on TPUs, GPUs, or CPUs by changing only the Trainer accelerator parameter.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

PyTorch Lightning wraps PyTorch training code to separate research logic from engineering boilerplate, enabling distributed training across GPUs, TPUs, and CPUs without code changes.

Yes. PyTorch Lightning is a mature, actively maintained framework (31287 stars, recent release) with zero known vulnerabilities, permissive licensing, and low install friction. It's worth installing if you want to reduce training boilerplate and gain automatic support for distributed training, mixed precision, and experiment management without learning a new deep-learning abstraction. If you're writing simple single-GPU scripts, the overhead may not justify it; for research or production workflows involving scaling, logging, or checkpointing, it's a clear win.

Install

pytorch-lightning on PyPI

pip

pip install pytorch-lightning

uv

uv add pytorch-lightning

poetry

poetry add pytorch-lightning

Installing pytorch-lightning

Before you install

Low friction install with a pure-Python wheel. Active maintenance with a recent release (79 days ago) and strong repository signals (31287 stars, last commit 2026-08-09). Depends on torch and eight other runtime packages, all standard in the ML ecosystem.

License in practice

Apache-2.0 permissive license allows commercial use, modification, and distribution with minimal restrictions—suitable for both research and production deployments.

Quickstart

pip install pytorch-lightning

import pytorch_lightning as pl
from torch.utils.data import DataLoader

class LitModel(pl.LightningModule):
    def training_step(self, batch, batch_idx):
        # your training logic
        return loss

trainer = pl.Trainer()
trainer.fit(model, DataLoader(train_data), DataLoader(val_data))

Requires Python >=3.10 and torch as a runtime dependency.

Verify before relying

  • Whether the 40+ advanced features mentioned in the description are all stable or some remain experimental.
  • Performance overhead compared to raw PyTorch for simple single-GPU training workflows.
  • Compatibility guarantees across the PyTorch versions tested (1.12, 1.13, 2.0, 2.1).

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 8 — torch, tqdm, PyYAML, fsspec, torchmetrics, packaging, typing-extensions, lightning-utilities
Maintenance actively maintained — 79 days since the last release
Last repo commit
First released
Downloads 11,232,102/month — #1,406 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

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

Keywords: deep learning, pytorch, AI

Development Status :: 5 - Production/StableEnvironment :: 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 :: Image RecognitionTopic :: Scientific/Engineering :: Information Analysis

Tags

pytorch training frameworkdistributed deep learningpytorch boilerplate reductionmulti-gpu training wrapperpytorch experiment managementlightning module trainerpytorch scaling framework
distributed-trainingpytorch-wrapperexperiment-management

More Artificial Intelligence packages