pytorch-fsdp

Configure PyTorch FSDP1 and FSDP2 for distributed training with mixed precision and CPU offloading.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates the complexity of manually implementing and debugging Fully Sharded Data Parallel (FSDP) training for large PyTorch models that exceed single-GPU memory limits, reducing development time and preventing common distributed training errors.

Core Features & Use Cases

  • FSDP1 & FSDP2 Configuration: Guidance for both legacy FSDP and modern FSDP2 implementations, including per-parameter sharding and device mesh setup.
  • Performance Optimization: Best practices for mixed precision training, CPU offloading, and communication scheduling to maximize training throughput.
  • Use Case: For example, when fine-tuning a 13B parameter open-source model across 8 GPUs, use this Skill to correctly configure sharding groups, avoid gradient synchronization hangs, and optimize memory usage without out-of-memory crashes.

Quick Start

Use the pytorch-fsdp skill to set up FSDP2 with mixed precision for your 7B parameter transformer model across 4 GPUs.

Frequently Asked Questions about pytorch-fsdp

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

FAQPage Schema
How do I use PyTorch FSDP to train large models that exceed single-GPU memory limits?

PyTorch FSDP overcomes single-GPU memory limits by sharding model parameters, gradients, and optimizer states across distributed GPUs. This Skill provides guidance for configuring FSDP1 and FSDP2 to scale large models without manual low-level distributed communication management.

What is the difference between FSDP1 and FSDP2 for parameter sharding?

FSDP2 is the modern implementation that offers per-parameter sharding and device mesh setup, while FSDP1 is the legacy version. This Skill provides configuration guidance for both versions to help you implement memory-efficient distributed training workflows.

How do I set up mixed precision and CPU offloading for distributed training in PyTorch?

You can set up mixed precision and CPU offloading in PyTorch to maximize training throughput and optimize memory usage. This Skill offers best practices for configuring these performance optimizations within Fully Sharded Data Parallel workflows.

Why does my PyTorch distributed training hang or crash with out-of-memory errors on multiple GPUs?

Out-of-memory crashes and gradient synchronization hangs are common distributed training errors. This Skill helps you correctly configure sharding groups and optimize memory usage to prevent these issues when fine-tuning large parameter models across multiple GPUs.

Can I use PyTorch FSDP for multi-node distributed training without manual communication management?

Yes, PyTorch FSDP supports both single-node and multi-node distributed training scenarios. This Skill provides expert guidance for device mesh initialization and debugging, enabling production-ready, memory-efficient training that scales without manual low-level distributed communication management.

What is the best way to configure a device mesh for a 7B parameter transformer across 4 GPUs?

The best way to configure a device mesh for a 7B parameter transformer is by using FSDP2 with mixed precision setup. This Skill provides the necessary guidance to initialize device meshes and per-parameter sharding for efficient multi-GPU training.