pytorch-fsdp

Apply PyTorch FSDP for sharded, mixed-precision distributed training of large models.

52|6|Updated Nov 24, 2025
One-click install
npx skills add https://github.com/ovachiever/droid-tings --skill pytorch-fsdp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-fsdp
Source: https://github.com/ovachiever/droid-tings/tree/main/skills/pytorch-fsdp
Command: npx skills add https://github.com/ovachiever/droid-tings --skill pytorch-fsdp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides expert guidance on Fully Sharded Data Parallel (FSDP) training in PyTorch, covering parameter sharding, mixed precision, CPU offloading, and advanced FSDP configurations for large-scale models.

Core Features & Use Cases

  • FSDP Fundamentals: Understand joinable constructs, device placement, and bucketed gradient reduction.
  • Deterministic Playbooks: Examples for configuring 2–8+ GPU setups with deterministic sharding.
  • Advanced Topics: Mixed precision, CPU offloading, and compatibility with cutting-edge optimizations.

Quick Start

Initialize a small-scale FSDP example with a 2-GPU setup and progressively scale.

Frequently Asked Questions about pytorch-fsdp

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

FAQPage Schema
How do I train large models efficiently across multiple GPUs using parameter sharding?

PyTorch FSDP (Fully Sharded Data Parallel) distributes model parameters across GPUs, reducing per-GPU memory footprint. FSDP automatically shards weights, activations, and gradients during training, enabling larger batch sizes and faster convergence on multi-GPU or multi-node setups with torch>=2.0.

What's the best way to set up distributed training with mixed precision and CPU offloading?

Combine FSDP with mixed-precision training to compute in lower precision while maintaining accuracy, reducing memory and bandwidth. Enable CPU offloading to move inactive parameters to CPU during forward/backward passes, freeing GPU memory for larger models or batches in memory-constrained environments.

Can I use FSDP with transformer models and what are the configuration requirements?

Yes, FSDP works with transformer models (compatible with transformers library and torch>=2.0). Configure parameter bucketing, gradient allreduce orchestration, and DDP initialization synchronization; scale deterministically from 2–8+ GPUs by adjusting shard strategy and synchronization settings per setup size.

How does FSDP2 differ from standard FSDP for large-scale distributed training?

FSDP2 provides enhanced multi-node distributed training with improved gradient allreduce orchestration and deterministic playbooks. It refines parameter bucketing and synchronization mechanisms, making large-scale training (8+ GPUs across multiple nodes) more stable and predictable than prior FSDP versions.

What are the memory and performance trade-offs when enabling CPU offload in FSDP?

CPU offloading reduces peak GPU memory by moving inactive parameters to host RAM, enabling larger model training. Trade-off: increased CPU-GPU communication latency and bandwidth overhead; effective for parameter-heavy models where GPU memory is the bottleneck, not compute speed.