Lightning-AI/pytorch-lightning
每日信息看板 · 2026-02-16
2026-02-16T19:06:03Z
Published
AI 总结
Lightning-AI 的 PyTorch Lightning 项目提供对原生 PyTorch 的工程化封装,自动处理分布式训练、混合精度与扩展部署,重要性在于显著降低训练基础设施复杂度并支持从单机到多节点的无缝扩展。
- 项目定位为深度学习训练框架,强调“你写模型逻辑,Lightning 处理工程细节”。
- 核心包含 PyTorch Lightning 与 Lightning Fabric 两个包,分别覆盖高层训练与专家级控制。
- 支持多GPU、多节点、TPU、16-bit 精度、早停、检查点、实验管理等 40+ 高级能力。
- 提供丰富示例,覆盖分类、分割、检测、文本摘要、音频生成、LLM 微调、扩散模型等任务。
- 与 Lightning Cloud 和 LitServe 生态联动,可用于云端训练与 Python 推理服务部署。
#GitHub #repo #开源项目 #PyTorch Lightning
内容摘录
<div align="center">
<img alt="Lightning" src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/ptl_banner.png" width="800px" style="max-width: 100%;">
<br/>
<br/>
**The deep learning framework to pretrain and finetune AI models.**
**Serving models?** Use LitServe to build custom inference servers in pure Python.
______________________________________________________________________
<p align="center">
<a href="#quick-start" style="margin: 0 10px;">Quick start</a> •
<a href="#examples">Examples</a> •
<a href="#why-pytorch-lightning">PyTorch Lightning</a> •
<a href="#lightning-fabric-expert-control">Fabric</a> •
<a href="https://lightning.ai/?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme">Lightning Cloud</a> •
<a href="#community">Community</a> •
<a href="https://pytorch-lightning.readthedocs.io/en/stable/">Docs</a>
</p>
<!-- DO NOT ADD CONDA DOWNLOADS... README CHANGES MUST BE APPROVED BY EDEN OR WILL -->
PyPI - Python Version
PyPI Status
PyPI - Downloads
Conda
codecov
Discord
!GitHub commit activity
license
<!--
CodeFactor
-->
</div>
<div align="center">
<p align="center">
<a target="_blank" href="https://lightning.ai/docs/pytorch/latest/starter/introduction.html?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme#define-a-lightningmodule">
<img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/get-started-badge.svg" height="36px" alt="Get started"/>
</a>
</p>
</div>
<a id="why-pytorch-lightning"></a>
Why PyTorch Lightning?
Training models in plain PyTorch requires writing and maintaining a lot of repetitive engineering code. Handling backpropagation, mixed precision, multi-GPU, and distributed training is error-prone and often reimplemented for every project. PyTorch Lightning organizes PyTorch code to automate this infrastructure while keeping full control over your model logic. You write the science. Lightning handles the engineering, and scales from CPU to multi-node GPUs without changing your core code. PyTorch experts can still opt into expert-level control.
Fun analogy: If PyTorch is Javascript, PyTorch Lightning is ReactJS or NextJS.
Looking for GPUs?
Lightning Cloud is the easiest way to run PyTorch Lightning without managing infrastructure. Start training with one command and get GPUs, autoscaling, monitoring, and a free tier. No cloud setup required.
You can also run PyTorch Lightning on your own hardware or cloud.
Lightning has 2 core packages
PyTorch Lightning: Train and deploy PyTorch at scale.
<br/>
Lightning Fabric: Expert control.
Lightning gives you granular control over how much abstraction you want to add over PyTorch.
<div align="center">
<img src="https://pl-public-data.s3.amazonaws.com/assets_lightning/continuum.png" width="80%">
</div>
Quick start
Install Lightning:
<!-- following section will be skipped from PyPI description -->
<details>
<summary>Advanced install options</summary>
<!-- following section will be skipped from PyPI description -->
Install with optional dependencies
Conda
Install stable version
Install future release from the source
Install bleeding-edge
Install nightly from the source (no guarantees)
or from testing PyPI
</details>
<!-- end skipping PyPI description -->
PyTorch Lightning example
Define the training workflow. Here's a toy example (explore real examples):
Run the model on your terminal
Convert from PyTorch to PyTorch Lightning
PyTorch Lightning is just organized PyTorch - Lightning disentangles PyTorch code to decouple the science from the engineering.
!PT to PL
----
Examples
Explore various types of training possible with PyTorch Lightning. Pretrain and finetune ANY kind of model to perform ANY task like classification, segmentation, summarization and more:
| Task | Description | Run |
|------|--------------|-----|
| Hello world | Pretrain - Hello world example | <a target="_blank" href="https://lightning.ai/lightning-ai/studios/pytorch-lightning-hello-world?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme"><img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/></a> |
| Image classification | Finetune - ResNet-34 model to classify images of cars | <a target="_blank" href="https://lightning.ai/lightning-ai/studios/image-classification-with-pytorch-lightning?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme"><img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/></a> |
| Image segmentation | Finetune - ResNet-50 model to segment images | <a target="_blank" href="https://lightning.ai/lightning-ai/studios/image-segmentation-with-pytorch-lightning?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme"><img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/></a> |
| Object detection | Finetune - Faster R-CNN model to detect objects | <a target="_blank" href="https://lightning.ai/lightning-ai/studios/object-detection-with-pytorch-lightning?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme"><img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/></a> |
| Text classification | Finetune - text classifier (BERT model) | <a target="_blank" href="https://lightning.ai/lightning-ai/studios/text-classification-with-pytorch-lightning?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme"><img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/></a> |
| Text summarization | Finetune - text summarization (Hugging Face transformer model) | <a target="_blank" href="https://lightning.ai/lightning-ai/studios/text-summarization-with-pytorch-lightning?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme"><img src="https://pl-bolts-doc-images.s3.us-east-…