pytorch-fsdp

Implement PyTorch FSDP training with parameter sharding, mixed precision, and CPU offloading.

97|8|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/peteromallet/megaplan --skill pytorch-fsdp-peteromallet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-fsdp
Source: https://github.com/peteromallet/megaplan/tree/main/megaplan/agent/skills/mlops/training/pytorch-fsdp
Command: npx skills add https://github.com/peteromallet/megaplan --skill pytorch-fsdp-peteromallet

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch>=2.0, transformers, and includes references (resource) components.

What problem does it solve?

Fully Sharded Data Parallel training enables memory-efficient scaling of large PyTorch models by distributing parameters and gradients across devices, reducing peak memory usage. This Skill provides expert guidance on configuring and optimizing Fully Sharded Data Parallel training with parameter sharding, mixed precision, and CPU offloading, including FSDP2 adoption.

Core Features & Use Cases

  • Parameter and gradient sharding across data-parallel workers to enable training of very large models.
  • Mixed-precision training and CPU offloading strategies to balance speed and memory.
  • Guidance for adopting FSDP2 and migrating from FSDP1 in real-world projects.

Quick Start

Apply pytorch-fsdp to shard model parameters across your device mesh and begin memory-efficient training.

Frequently Asked Questions about pytorch-fsdp

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

FAQPage Schema
How do I use PyTorch FSDP for parameter sharding across multiple GPUs?

PyTorch FSDP parameter sharding distributes model parameters and gradients across data-parallel workers to reduce peak GPU memory usage. You apply it to shard parameters across your device mesh, enabling memory-efficient training for very large models.

Does PyTorch FSDP support CPU offloading for memory optimization?

Yes, PyTorch FSDP supports CPU offloading strategies to balance training speed and memory. It provides mixed-precision training and CPU offloading configurations to optimize memory consumption during multi-GPU model training.

What is the best way to migrate from FSDP1 to FSDP2?

The best way to migrate from FSDP1 to FSDP2 involves checking compatibility with sharding APIs and adopting the updated FSDP2 implementation. This provides specific guidance for adopting FSDP2 and migrating from FSDP1 in real-world projects.

Do I need PyTorch 2.x to implement Fully Sharded Data Parallel training?

Yes, you need PyTorch 2.0 or higher to implement Fully Sharded Data Parallel training. Familiarity with FSDP concepts and device meshes is also required to properly configure sharding APIs and multi-node workflows.

When should I use FSDP for distributed training instead of standard data parallel?

You should use FSDP when standard data parallel training exceeds available GPU memory for large models. FSDP shards parameters and gradients across devices, significantly reducing peak memory usage to enable training at scales impossible with standard methods.

Why does FSDP require familiarity with device meshes and sharding APIs?

FSDP requires familiarity with device meshes and sharding APIs because it orchestrates parameter and gradient distribution across multi-GPU and multi-node environments. Proper configuration ensures correct memory optimization and compatibility during mixed-precision training.