pytorch-fsdp

Configure PyTorch FSDP2 sharding, mixed precision, and CPU offloading for distributed training.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This skill addresses the complexity of implementing and debugging large-scale distributed training in PyTorch, specifically focusing on Fully Sharded Data Parallel (FSDP) and FSDP2 architectures.

Core Features & Use Cases

  • FSDP Optimization: Provides guidance on parameter sharding, mixed precision, and CPU offloading to maximize GPU memory efficiency.
  • Distributed Debugging: Assists in resolving common distributed training issues like uneven inputs, hanging processes, and collective communication mismatches.
  • Use Case: Use this skill to configure a multi-node training job using FSDP2, ensuring optimal sharding strategies and correct usage of the Join context manager for uneven input handling.

Quick Start

Use the pytorch-fsdp skill to explain how to configure FSDP2 for a transformer model with CPU offloading enabled.

Frequently Asked Questions about pytorch-fsdp

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

FAQPage Schema
How do I configure FSDP2 for a transformer model with CPU offloading enabled?

To configure FSDP2 for a transformer model with CPU offloading, you must initialize the Fully Sharded Data Parallel wrapper with specific parameters for parameter sharding and mixed precision, ensuring optimal GPU memory efficiency during large-scale distributed training.

Why does my PyTorch distributed training hang on uneven inputs?

Uneven inputs cause PyTorch distributed training to hang due to collective communication mismatches. You can resolve this by using the Join context manager within your Fully Sharded Data Parallel workflow to handle varying input sizes across processes.

What is the best way to maximize GPU memory efficiency for large-scale deep learning models?

The best way to maximize GPU memory efficiency for large-scale deep learning models is to implement Fully Sharded Data Parallel, utilizing parameter sharding, mixed precision, and CPU offloading to optimize memory management across distributed training environments.

Can I use Fully Sharded Data Parallel with Hugging Face transformers?

Yes, you can use Fully Sharded Data Parallel with Hugging Face transformers. The implementation requires PyTorch and the transformers library to configure parameter sharding and collective communication primitives for large-scale model training.

When should I not use parameter sharding in PyTorch?

You should avoid parameter sharding in PyTorch when your deep learning model fits comfortably within a single GPU's memory limits, as FSDP introduces collective communication overhead that degrades performance without providing significant memory management benefits for smaller models.