pytorch-fsdp

Configure PyTorch FSDP parameter sharding, mixed precision, and CPU offloading.

2|1|Updated Jul 14, 2026
One-click install
npx skills add https://github.com/heysuhas/hermes_cli --skill pytorch-fsdp-heysuhas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-fsdp
Source: https://github.com/heysuhas/hermes_cli/tree/main/optional-skills/mlops/pytorch-fsdp
Command: npx skills add https://github.com/heysuhas/hermes_cli --skill pytorch-fsdp-heysuhas

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This skill addresses the memory and communication bottlenecks inherent in training massive deep learning models by providing expert guidance on Fully Sharded Data Parallel (FSDP) configurations.

Core Features & Use Cases

  • Memory Optimization: Provides strategies for parameter sharding, CPU offloading, and mixed precision to fit large models on limited GPU memory.
  • Distributed Training: Offers implementation patterns for FSDP2, including device mesh setup and collective communication scheduling.
  • Use Case: When training a large language model that exceeds the memory capacity of a single GPU, use this skill to configure FSDP to shard model parameters across multiple nodes, enabling efficient training without sacrificing performance.

Quick Start

Ask the pytorch-fsdp skill to explain how to implement fully_shard on a transformer model layer to optimize memory usage.

Frequently Asked Questions about pytorch-fsdp

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

FAQPage Schema
How does parameter sharding in PyTorch distributed training reduce GPU memory usage?

Parameter sharding in PyTorch distributed training reduces GPU memory by partitioning model parameters across multiple GPUs instead of replicating them. This allows training large models that exceed single GPU memory limits by gathering shards only when needed for forward or backward computation.

How do I implement fully_shard on a transformer model layer to optimize memory?

To implement fully_shard on a transformer model, wrap the model layers with the fully_shard API call. This shards parameters across the device mesh, automatically handling gradient synchronization and parameter gathering during the forward and backward passes to optimize memory.

Does PyTorch FSDP support CPU offloading and mixed precision?

Yes, PyTorch FSDP supports CPU offloading and mixed precision. You can configure CPU offloading to move parameters to host memory, while mixed precision uses reduced floating point formats to further decrease memory consumption and accelerate distributed communication across GPUs.

What is the difference between FSDP1 and FSDP2 in PyTorch?

The transition from FSDP1 to FSDP2 in PyTorch introduces per-parameter sharding and device mesh based architecture. FSDP2 offers finer-grained memory management, improved collective communication scheduling, and better integration with PyTorch native distributed training features compared to the original FSDP1 implementation.

Can I use PyTorch FSDP for training large language models across multiple nodes?

Yes, you can use PyTorch FSDP for training large language models across multiple nodes. FSDP configures device meshes and schedules collective communications to shard transformer parameters efficiently, enabling distributed training of massive models that exceed the memory capacity of a single GPU.