pytorch-fsdp

Configure and debug PyTorch FSDP2 distributed training with parameter sharding.

1|Updated May 16, 2026
One-click install
npx skills add https://github.com/devMoez/titan --skill pytorch-fsdp-devmoez
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-fsdp
Source: https://github.com/devMoez/titan/tree/main/optional-skills/mlops/pytorch-fsdp
Command: npx skills add https://github.com/devMoez/titan --skill pytorch-fsdp-devmoez

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps you implement and troubleshoot large-scale distributed training using PyTorch Fully Sharded Data Parallel (FSDP), addressing common issues like inefficient sharding, mixed-precision pitfalls, CPU offloading configuration, and correctness/performance bottlenecks.

Core Features & Use Cases

  • FSDP design guidance (FSDP2-focused): Understand when to use FSDP2 vs FSDP1 concepts like parameter sharding, unshard/reshard hooks, and optimizer expectations.
  • Performance & memory configuration: Choose practical settings for mixed precision and CPU offloading to fit models into limited GPU memory while keeping throughput stable.
  • Distributed correctness patterns: Apply reliable distributed training patterns (e.g., handling uneven inputs via join context concepts) to avoid hangs and mismatched collectives in real training loops.

Quick Start

Use the pytorch-fsdp skill to design an FSDP2 training setup for your model with mixed precision and CPU offloading, including how to verify correctness and performance.

Frequently Asked Questions about pytorch-fsdp

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

FAQPage Schema
How do I configure PyTorch FSDP2 for parameter sharding and mixed precision?

To configure PyTorch FSDP2 for parameter sharding and mixed precision, you apply DTensor-based workflows and specific unshard/reshard hooks. This setup manages optimizer expectations while fitting large models into limited GPU memory and stabilizing throughput.

What is the difference between FSDP2 and FSDP1 in PyTorch distributed training?

The difference between FSDP2 and FSDP1 in PyTorch distributed training lies in DTensor-based parameter sharding workflows. FSDP2 introduces updated unshard/reshard hooks and optimizer expectations, offering a refined approach to memory management and collective scheduling.

Why does my PyTorch distributed training hang on uneven inputs?

PyTorch distributed training hangs on uneven inputs due to mismatched collective operations across ranks. You can resolve this by applying the join context pattern within your FSDP training loop to handle uneven inputs and prevent rank synchronization hangs.

Can I use CPU offloading with PyTorch FSDP to reduce GPU memory usage?

Yes, you can use CPU offloading with PyTorch FSDP to reduce GPU memory usage. Configuring CPU offloading alongside mixed precision settings allows you to fit large models into limited GPU memory while maintaining training throughput stability.

Does PyTorch FSDP work with the transformers library for large model training?

Yes, PyTorch FSDP works with the transformers library for large model training. You can apply FSDP2 configuration and distributed correctness patterns to transformer models, addressing sharding and mixed-precision pitfalls across your distributed environment.

What are the limitations of using CPU offloading in PyTorch FSDP?

The limitations of using CPU offloading in PyTorch FSDP involve potential throughput bottlenecks from CPU-GPU data transfer latency. While it reduces GPU memory pressure, you must balance offloading settings to avoid degrading overall distributed training performance.