pytorch-fsdp

Guide PyTorch FSDP2 setup, debugging, and migration from FSDP1.

Updated May 3, 2026
One-click install
npx skills add https://github.com/Yangel-hide/video-production-planner-agent --skill pytorch-fsdp-yangel-hide
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-fsdp
Source: https://github.com/Yangel-hide/video-production-planner-agent/tree/main/optional-skills/mlops/pytorch-fsdp
Command: npx skills add https://github.com/Yangel-hide/video-production-planner-agent --skill pytorch-fsdp-yangel-hide

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provide expert guidance for implementing and debugging Fully Sharded Data Parallel (FSDP) with PyTorch, helping teams scale training efficiently without memory bottlenecks.

Core Features & Use Cases

  • Comprehensive guidance on PyTorch FSDP/FS DP2, including per-parameter sharding, CPU offloading, and mixed precision.
  • Best practices for migrating from FSDP1 to FSDP2, model layout strategies, and memory-management techniques.
  • Use cases include large-scale NLP or vision models trained across data-parallel workers with memory constraints.

Quick Start

Apply fully_shard to your model and run a training step to boot FSDP2 memory savings.

Frequently Asked Questions about pytorch-fsdp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is PyTorch FSDP and when do I need it for distributed training?

PyTorch FSDP is a distributed training technique that shards model parameters, gradients, and optimizer states across data-parallel workers. You need FSDP when training large-scale NLP or vision models that exceed single-GPU memory constraints.

How do I apply per-parameter sharding in FSDP2 to maximize memory efficiency?

To apply per-parameter sharding in FSDP2, use the fully_shard function on your model and execute a training step. This enables per-parameter sharding, mixed precision, and CPU offloading to maximize memory efficiency.

What is the best way to migrate from FSDP1 to FSDP2 for large-scale models?

The best way to migrate from FSDP1 to FSDP2 involves adopting per-parameter sharding and applying fully_shard to your model. FSDP2 offers improved memory management and layer-by-layer grouping strategies for large-scale models.

Does PyTorch FSDP2 support CPU offloading and mixed precision training?

Yes, PyTorch FSDP2 fully supports CPU offloading and mixed precision training. These features are integral to the implementation, allowing you to maximize memory efficiency during fully sharded data-parallel training.

Why does my PyTorch FSDP training run out of memory with large-scale models?

PyTorch FSDP training runs out of memory when model layouts are poorly grouped or sharding is incomplete. Implementing layer-by-layer grouping, mixed precision, and CPU offloading resolves memory bottlenecks.

Can I use PyTorch FSDP2 for memory optimization across multiple data-parallel workers?

Yes, you can use PyTorch FSDP2 across multiple data-parallel workers to achieve memory optimization. It provides per-parameter sharding and tooling references specifically designed to enable scalable distributed training under memory constraints.