pytorch-fsdp

Apply FSDP2 fully_shard to shard PyTorch model parameters across a DeviceMesh.

1|1|Updated Apr 26, 2026
One-click install
npx skills add https://github.com/BermudaLocals/hermes-agent-lite --skill pytorch-fsdp-bermudalocals
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-fsdp
Source: https://github.com/BermudaLocals/hermes-agent-lite/tree/main/optional-skills/mlops/pytorch-fsdp
Command: npx skills add https://github.com/BermudaLocals/hermes-agent-lite --skill pytorch-fsdp-bermudalocals

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Fully sharded data parallelism reduces memory pressure for large models by distributing parameters and state across devices.

Core Features & Use Cases

  • Memory-efficient training with per-parameter DTensor sharding
  • All-gather before forward and reduce-scatter after backward to synchronize gradients
  • Bottom-up grouping across model layers for scalable memory savings with FSDP2

Quick Start

Apply fully_shard to your model and run your training script with a defined DeviceMesh to enable FSDP2 sharding across the cluster.

Frequently Asked Questions about pytorch-fsdp

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

FAQPage Schema
How do I shard PyTorch model parameters across multiple GPUs?

FSDP2 reduces memory pressure by distributing parameters and state across devices. It uses bottom-up parameter sharding to group model layers, enabling scalable memory savings for transformer-scale training on large clusters.

How do I set up distributed training with FSDP2 and DTensor?

Set up distributed training with FSDP2 and DTensor by defining a DeviceMesh and applying the fully_shard frontend. This enables per-parameter DTensor sharding, pre-forward all-gather, and post-backward reduce-scatter for synchronized gradients across ranks.

Do I need a DeviceMesh to use fully sharded data parallel in PyTorch?

FSDP2 distinguishes itself through per-parameter DTensor sharding and bottom-up grouping across model layers. This approach provides scalable memory savings by applying pre-forward all-gather and post-backward reduce-scatter for synchronized gradients.

When should I use FSDP2 for distributed training?

Use FSDP2 for transformer-scale training when large models exceed single-GPU memory limits. It distributes parameters and state across devices by applying bottom-up parameter sharding to reduce memory pressure and enable scalable training.

How does FSDP synchronize gradients across GPUs?

FSDP2 uses a DTensor-based setup with the fully_shard frontend to shard parameters. You define a DeviceMesh, apply fully_shard to your model layers bottom-up, and run your training script to enable sharding across the cluster.