uv-pytorch-fsdp2

Integrate PyTorch FSDP2 fully_shard into training scripts with DCP checkpointing.

1|Updated Feb 6, 2026
One-click install
npx skills add https://github.com/uv-xiao/pkbllm --skill uv-pytorch-fsdp2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: uv-pytorch-fsdp2
Source: https://github.com/uv-xiao/pkbllm/tree/main/knowledge/ML/distributed/pytorch-fsdp2
Command: npx skills add https://github.com/uv-xiao/pkbllm --skill uv-pytorch-fsdp2

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill enables coding agents to correctly integrate PyTorch FSDP2 (Fully Sharded Data Parallel 2.0) into training scripts, addressing the complexities of distributed training for large models that exceed single-GPU memory.

Core Features & Use Cases

  • Correct FSDP2 Initialization: Ensures proper setup of distributed training environments.
  • Sharding Configuration: Guides the application of fully_shard bottom-up for optimal memory and performance.
  • Mixed Precision & Offload: Configures mixed precision and CPU offloading for memory-bound scenarios.
  • Distributed Checkpointing: Integrates PyTorch Distributed Checkpoint (DCP) for robust saving and loading.
  • Use Case: Training a massive language model that requires more GPU memory than available on a single device, by distributing parameters, gradients, and optimizer states across multiple GPUs and nodes.

Quick Start

Integrate PyTorch FSDP2 into your existing training script by following the step-by-step procedure outlined in the skill's documentation.

Frequently Asked Questions about uv-pytorch-fsdp2

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

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

PyTorch FSDP2 enables training large models exceeding single-GPU memory by applying the `fully_shard` API bottom-up, distributing parameters, gradients, and optimizer states across multiple GPUs and nodes.

What is the correct way to apply fully_shard for bottom-up sharding in PyTorch?

Bottom-up sharding with `fully_shard` in PyTorch involves applying the API sequentially from the innermost model layers to the outermost, ensuring optimal memory management and performance for distributed training.

How do I set up distributed checkpointing with DCP for FSDP2 training scripts?

Distributed checkpointing with DCP for FSDP2 training scripts involves integrating PyTorch Distributed Checkpoint to robustly save and load sharded model states across multiple devices during training.

Can I configure mixed precision and CPU offloading for memory-bound distributed training?

Mixed precision and CPU offloading can be configured for memory-bound distributed training scenarios in PyTorch FSDP2, allowing you to manage GPU memory limits when training massive models.

When do I need to use PyTorch FSDP2 instead of standard data parallel training?

You need PyTorch FSDP2 when training massive language models that require more GPU memory than available on a single device, requiring the distribution of parameters, gradients, and optimizer states across multiple GPUs.