pytorch-fsdp

Configure FSDP1 and FSDP2 training with parameter sharding and CPU offloading.

247|22|Updated Dec 11, 2024
One-click install
npx skills add https://github.com/graniet/kheish --skill pytorch-fsdp-graniet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-fsdp
Source: https://github.com/graniet/kheish/tree/main/skills/mlops/training/pytorch-fsdp
Command: npx skills add https://github.com/graniet/kheish --skill pytorch-fsdp-graniet

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates the steep learning curve and common pitfalls of implementing Fully Sharded Data Parallel (FSDP) training for large PyTorch models, which often suffer from memory inefficiencies, misconfigured sharding, or collective communication hangs when set up manually.

Core Features & Use Cases

  • FSDP1 & FSDP2 Support: Comprehensive guidance for both legacy FSDP1 and modern FSDP2 implementations, including parameter sharding, mixed precision configuration, and CPU offloading setup.
  • Distributed Training Troubleshooting: Assistance with resolving common issues like uneven input handling, process group misconfiguration, and memory optimization for multi-GPU and multi-node training workflows.
  • Use Case: For example, a machine learning engineer training a 70B parameter language model can use this Skill to correctly configure FSDP2 with CPU offloading to fit the model across 8 GPUs while maintaining training throughput.

Quick Start

Use the pytorch-fsdp skill to set up Fully Sharded Data Parallel training for your 13B parameter transformer model with mixed precision and 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 set up PyTorch FSDP for training large-scale models?

To set up PyTorch FSDP for large-scale training, you configure parameter sharding, establish collective communication process groups, and apply mixed precision to optimize memory across multiple GPUs.

What is the difference between FSDP1 and FSDP2 in PyTorch?

FSDP1 is the legacy implementation for Fully Sharded Data Parallel, while FSDP2 is the modern approach offering improved parameter sharding, mixed precision configuration, and CPU offloading setup for distributed training.

Can I use CPU offloading with PyTorch FSDP to fit a 70B parameter model?

Yes, you can use CPU offloading with PyTorch FSDP to fit a 70B parameter model across 8 GPUs, offloading parameters to CPU memory while maintaining training throughput.

Why does my PyTorch FSDP training hang during distributed setup?

PyTorch FSDP training hangs often occur due to misconfigured collective communication process groups, uneven input handling across ranks, or incorrect sharding configurations that require specific troubleshooting steps.

When should I use mixed precision in PyTorch FSDP workflows?

You should use mixed precision in PyTorch FSDP workflows when you need to optimize memory efficiency for GPU-accelerated large-scale training, reducing memory footprint while maintaining throughput.