# 完全分片数据并行（FSDP2）入门

- 原标题：Getting Started with Fully Sharded Data Parallel \(FSDP2\)
- 类型：教程
- 来源：docs.pytorch.org
- 发布时间：2023-01-01
- 首次精选：2026-10-29 23:09
- 分级：值得看
- 学习层级：进阶
- 主题：[inference-hardware-memory](<https://oplearnx.com/md/topics/inference-hardware-memory.md>)（第 24 位）、[model-serving-compute](<https://oplearnx.com/md/topics/model-serving-compute.md>)（第 36 位）
- 原文链接：[https://docs.pytorch.org/tutorials/intermediate/FSDP\_tutorial.html](<https://docs.pytorch.org/tutorials/intermediate/FSDP_tutorial.html>)
- 本站页面：[https://oplearnx.com/resources/pk\_659af57c0863](<https://oplearnx.com/resources/pk_659af57c0863>)

## 摘要

PyTorch 官方中级教程，介绍 FSDP2 的工作方式，示例代码来自 pytorch/examples。正文对比 DDP，说明 FSDP 通过分片模型参数、梯度和优化器状态来降低 GPU 显存占用，使单卡放不下的模型也能训练；并描述前向与反向计算之外参数处于完全分片状态、计算前对分片参数做 all-gather、反向中对未分片梯度做 reduce-scatter 等流程。页面说明 FSDP1 已弃用，其教程已归档。

---
来源：LearnMap · 学径（https://oplearnx.com）
