pytorch-fsdp

Configure PyTorch FSDP training with sharding, mixed precision, and CPU offloading.

Updated Sep 1, 2021
One-click install
npx skills add https://github.com/unclehowell/unclehowell --skill pytorch-fsdp-unclehowell
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-fsdp
Source: https://github.com/unclehowell/unclehowell/tree/main/skills/mlops/training/pytorch-fsdp
Command: npx skills add https://github.com/unclehowell/unclehowell --skill pytorch-fsdp-unclehowell

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Training massive models across many GPUs often runs out of memory and requires complex setup for parameter sharding, mixed precision, and CPU offloading. This skill removes the need to manually configure PyTorch Fully Sharded Data Parallel (FSDP) and guides users through best‑practice setups.

Core Features & Use Cases

  • Automatic FSDP configuration: Selects appropriate sharding level, mixed‑precision mode, and CPU offloading based on the model and hardware.
  • Scalable multi‑node launches: Generates the correct torchrun command and environment variables for NCCL, Gloo, or other backends.
  • Migration assistance: Helps move existing DDP or single‑GPU scripts to FSDP2 with minimal code changes.
  • Use case example: A researcher wants to fine‑tune a 1.5B‑parameter transformer on a 4‑node, 8‑GPU‑per‑node cluster while keeping memory usage under 12 GB per GPU.

Quick Start

Ask the skill to set up and launch an FSDP training session for your model on the target cluster.

Frequently Asked Questions about pytorch-fsdp

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

FAQPage Schema
How do I configure PyTorch FSDP for multi-node training?

To configure PyTorch FSDP for multi-node training, you need to set up parameter sharding, mixed precision, and CPU offloading. This skill automatically generates the correct torchrun commands and environment variables for NCCL or Gloo backends to launch your sessions.

How can I reduce GPU memory usage when fine-tuning large transformer models?

Reducing GPU memory usage for large transformer models requires parameter sharding and mixed precision. FSDP shards model parameters across GPUs and optionally offloads them to CPU, keeping memory usage low during distributed training.

How do I migrate a DDP script to FSDP2?

Migrating a DDP script to FSDP2 requires updating your training loop to support parameter sharding and mixed precision. This skill provides migration assistance to help move existing distributed data parallel scripts to FSDP2 with minimal code changes.

Does PyTorch FSDP support CPU offloading and mixed precision?

Yes, PyTorch FSDP supports CPU offloading and mixed precision. This skill automatically selects the appropriate mixed-precision mode and CPU offloading configuration based on your specific model and hardware environment constraints.

What is the best way to launch distributed training across multiple GPUs?

The best way to launch distributed training across multiple GPUs is using torchrun with FSDP configuration. It handles parameter sharding and communication backends efficiently, preventing out-of-memory errors in large-scale multi-GPU or multi-node environments.