huggingface-accelerate

Adds distributed training support to PyTorch scripts using HuggingFace Accelerate's unified API.

14|5|Updated Apr 9, 2026
One-click install
npx skills add https://github.com/MLT-OSS/hermes-agent-go --skill huggingface-accelerate-mlt-oss
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: huggingface-accelerate
Source: https://github.com/MLT-OSS/hermes-agent-go/tree/main/optional-skills/mlops/accelerate
Command: npx skills add https://github.com/MLT-OSS/hermes-agent-go --skill huggingface-accelerate-mlt-oss

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires accelerate, torch, transformers, and includes references (resource) components.

What problem does it solve? Scaling PyTorch training from a single GPU to multi-GPU or multi-node clusters normally requires rewriting code for DDP, DeepSpeed, FSDP, or Megatron, each with different APIs and launcher setups. This Skill provides a unified approach that adds distributed support with minimal code changes. ## Core Features & Use Cases - Unified Distributed API: Convert any PyTorch script to distributed training with four lines of code using Accelerator and accelerator.prepare(). - Backend Flexibility: Switch between DDP, DeepSpeed ZeRO, FSDP, and Megatron-LM through configuration without changing training code. - Mixed Precision & Memory Optimization: Enable FP16, BF16, or FP8 training, gradient accumulation, gradient checkpointing, and CPU/NVMe offloading. - Use Case: You have a single-GPU training script that runs out of memory on a 70B model. Use this Skill to configure FSDP with full sharding and BF16 mixed precision, then launch across 8 GPUs with one accelerate launch command. ## Quick Start Convert my PyTorch training script to run on multiple GPUs using HuggingFace Accelerate and show me the launch command.

Frequently Asked Questions about huggingface-accelerate

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

FAQPage Schema
How do I convert a PyTorch script to multi-GPU training?

Add four lines with HuggingFace Accelerate: import Accelerator, instantiate it, pass your model, optimizer, and dataloader through accelerator.prepare(), and replace loss.backward() with accelerator.backward(loss). Then launch with accelerate launch train.py.

Accelerate vs PyTorch Lightning vs DeepSpeed for distributed training?

Accelerate offers a minimal unified API over DDP, DeepSpeed, FSDP, and Megatron with only four lines of code changes. PyTorch Lightning provides higher-level abstractions and callbacks, while raw DeepSpeed gives direct API control for advanced features.

Does Accelerate support DeepSpeed ZeRO-3 and FSDP?

Yes, Accelerate supports DeepSpeed ZeRO stages 2 and 3 via DeepSpeedPlugin and FSDP via FullyShardedDataParallelPlugin, including CPU and NVMe offloading. You can configure either through accelerate config or programmatically in Python.

Why is gradient accumulation not working with Accelerate?

Gradient accumulation requires wrapping the training step in the accelerator.accumulate(model) context manager. Set gradient_accumulation_steps when creating the Accelerator, and the context manager handles synchronization timing automatically.

Can Accelerate train large models like 70B parameters?

Yes, using FSDP with FULL_SHARD strategy or Megatron-LM with tensor and pipeline parallelism. For a 70B model, typical configurations use 64 GPUs with TP=8, PP=2, and BF16 mixed precision on A100 80GB hardware.