pytorch-fsdp

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

Updated May 8, 2026
One-click install
npx skills add https://github.com/superfhp/lumi-agent --skill pytorch-fsdp-superfhp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-fsdp
Source: https://github.com/superfhp/lumi-agent/tree/main/optional-skills/mlops/pytorch-fsdp
Command: npx skills add https://github.com/superfhp/lumi-agent --skill pytorch-fsdp-superfhp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch>=2.0, transformers, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides expert guidance for optimizing Fully Sharded Data Parallel (FSDP) training in PyTorch, addressing parameter sharding, mixed precision, CPU offloading, and FSDP2 features.

Core Features & Use Cases

  • Parameter Sharding: Expert advice on implementing parameter sharding for efficient distributed training.
  • Mixed Precision: Guidance on using mixed precision for improved training performance.
  • CPU Offloading: Techniques for CPU offloading to enhance training speed.
  • FSDP2: Detailed explanations and best practices for FSDP2, the latest iteration of FSDP.
  • Use Case: For a data scientist running large-scale neural network training with PyTorch and facing challenges with memory constraints and slow training speed, this Skill offers solutions and best practices to optimize the training process.

Quick Start

To get started with the pytorch-fsdp skill, run the command: hermes run pytorch-fsdp --example <path_to_example>

Frequently Asked Questions about pytorch-fsdp

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

FAQPage Schema
How do I optimize PyTorch distributed training when facing high memory consumption?

You can optimize PyTorch distributed training by applying Fully Sharded Data Parallel (FSDP) to shard parameters across GPUs, utilizing mixed precision and CPU offloading to reduce high memory consumption and improve training speed.

What is parameter sharding and how does it work in FSDP?

Parameter sharding in FSDP works by distributing model parameters across distributed training workers rather than replicating them, significantly lowering per-GPU memory requirements for large-scale neural networks.

Does FSDP support CPU offloading and mixed precision for large-scale neural networks?

Yes, FSDP supports both mixed precision to accelerate computation and CPU offloading to free up GPU memory, specifically targeting large-scale neural network training workflows with high memory constraints.

What's the best way to start using FSDP2 features in PyTorch?

The best way to start with FSDP2 is to run the provided example scripts using the command `hermes run pytorch-fsdp --example <path_to_example>`, which demonstrates the latest FSDP2 best practices.

Do I need specific PyTorch and transformers versions to use CPU offloading with FSDP?

Yes, you need PyTorch version 2.0 or higher and the transformers library installed, as these dependencies provide the necessary torch.distributed and FSDP functionalities required for CPU offloading and specific features.

Why does my PyTorch FSDP training run slowly despite having sufficient GPU memory?

PyTorch FSDP training might run slowly if mixed precision is not utilized. Implementing mixed precision can improve training performance while maintaining model accuracy across distributed workers.