What problem does it solve?
This Skill enables training of large PyTorch models that exceed single-GPU memory by correctly implementing PyTorch's Fully Sharded Data Parallelism (FSDP2), including distributed checkpointing and mixed precision.
Core Features & Use Cases
- Model Parallelism: Distributes model parameters, gradients, and optimizer states across multiple GPUs and nodes.
- Memory Optimization: Reduces peak memory usage per GPU, allowing for larger models.
- Distributed Checkpointing: Integrates with PyTorch's Distributed Checkpoint (DCP) for robust saving and loading of distributed states.
- Mixed Precision & Offload: Configures mixed precision training and CPU offloading for further memory and performance gains.
- Use Case: Train a multi-billion parameter language model by sharding its components across a cluster of GPUs, ensuring efficient memory utilization and fault-tolerant checkpointing.
Quick Start
Launch your PyTorch training script using torchrun, ensuring distributed initialization and applying the fully_shard wrapper bottom-up to your model's submodules before the root.