pytorch-fsdp2

Integrate PyTorch FSDP2 fully_shard into training scripts with DTensor sharding and DCP checkpointing.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/DoanNgocCuong/continuous-training-pipeline_T3_2026 --skill pytorch-fsdp2-doanngoccuong
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-fsdp2
Source: https://github.com/DoanNgocCuong/continuous-training-pipeline_T3_2026/tree/main/.claude/skills/pytorch-fsdp2
Command: npx skills add https://github.com/DoanNgocCuong/continuous-training-pipeline_T3_2026 --skill pytorch-fsdp2-doanngoccuong

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables coding agents to correctly integrate PyTorch's Fully Sharded Data Parallel (FSDP2) into training scripts, overcoming challenges with model memory limits and distributed training complexities.

Core Features & Use Cases

  • FSDP2 Integration: Adds PyTorch FSDP2 (fully_shard) with proper initialization, sharding, mixed precision, and distributed checkpointing.
  • Memory Optimization: Essential for training models that exceed single-GPU memory capacity.
  • DTensor-based Sharding: Leverages DTensor for inspectable, per-parameter sharding, composable with DeviceMesh.
  • Use Case: When training a large language model that requires more VRAM than available on a single GPU, this Skill ensures FSDP2 is applied correctly to shard parameters, gradients, and optimizer states across multiple GPUs or nodes.

Quick Start

Use the pytorch-fsdp2 skill to add PyTorch FSDP2 to your existing training script, ensuring correct initialization, sharding, and checkpointing.

Frequently Asked Questions about pytorch-fsdp2

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

FAQPage Schema
How do I use PyTorch FSDP2 for distributed training of large models?

FSDP2 uses DTensor for inspectable, per-parameter sharding composable with DeviceMesh. This approach handles optimizer setup with DTensor parameters and applies mixed precision, overcoming single-GPU memory limits for large language model training.

How do I set up distributed checkpointing with PyTorch FSDP2?

FSDP2 implements distributed checkpointing using DCP to save and load sharded model states across multiple GPUs. This ensures correct state recovery for DTensor parameters during large model training.

When do I need DTensor-based sharding for PyTorch distributed training?

DTensor-based sharding is needed when training large models exceeding single-GPU VRAM. FSDP2 leverages DTensor with DeviceMesh to shard parameters, gradients, and optimizer states across multiple GPUs or nodes efficiently.

Can I use mixed precision training with PyTorch FSDP2?

Yes, PyTorch FSDP2 supports mixed precision training. The skill integrates mixed precision configuration into the fully_shard setup to optimize memory usage and accelerate large model training across multiple GPUs.

Does PyTorch FSDP2 work with DeviceMesh for model sharding?

Yes, FSDP2 is composable with DeviceMesh. It leverages DTensor for per-parameter sharding across the device mesh, enabling inspectable and flexible distribution of model parameters over multiple GPUs.

What are the limitations of using PyTorch FSDP2 for large model training?

FSDP2 requires models to be initialized correctly with bottom-up sharding and DTensor parameters. It is applicable specifically for models exceeding single-GPU memory and requires a multi-GPU environment with DeviceMesh.