npx skills add ...
npx skills add orchestra-research/ai-research-skills --skill huggingface-accelerate
Simplest distributed training API. 4 lines to add distributed support to any PyTorch script. Unified API for DeepSpeed/FSDP/Megatron/DDP. Automatic device placement, mixed precision (FP16/BF16/FP8). Interactive config, single launch command. HuggingFace ecosystem standard.
npx skills add orchestra-research/ai-research-skills --skill huggingface-accelerate
Accelerate simplifies distributed training to 4 lines of code.
Installation:
Convert PyTorch script (4 lines):
Run (single command):
Original script:
With Accelerate (4 lines added):
Configure (interactive):
Questions:
Launch (works on any setup):
Enable FP16/BF16:
Enable DeepSpeed ZeRO-2:
Or via config:
deepspeed_config.json:
Launch:
Enable FSDP:
Or via config:
Accumulate gradients:
Effective batch size: batch_size * num_gpus * gradient_accumulation_steps
Use Accelerate when:
Key advantages:
Use alternatives instead:
Issue: Wrong device placement
Don't manually move to device:
Issue: Gradient accumulation not working
Use context manager:
Issue: Checkpointing in distributed
Use accelerator methods:
Issue: Different results with FSDP
Ensure same random seed:
Megatron integration: See references/megatron-integration.md for tensor parallelism, pipeline parallelism, and sequence parallelism setup.
Custom plugins: See references/custom-plugins.md for creating custom distributed plugins and advanced configuration.
Performance tuning: See references/performance.md for profiling, memory optimization, and best practices.
Launcher requirements:
torch.distributed.run (built-in)deepspeed (pip install deepspeed)