huggingface-accelerate

Abstract distributed PyTorch training with the Accelerate API.

Updated May 2, 2026
One-click install
npx skills add https://github.com/qcmuu/AI-Research-Skills --skill huggingface-accelerate-qcmuu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: huggingface-accelerate
Source: https://github.com/qcmuu/AI-Research-Skills/tree/main/08-distributed-training/accelerate
Command: npx skills add https://github.com/qcmuu/AI-Research-Skills --skill huggingface-accelerate-qcmuu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves the complexity of turning a single-GPU PyTorch training script into a robust multi-GPU and mixed-precision training workflow without rewriting core logic.

Core Features & Use Cases

  • Unified distributed launcher: Run the same training code across DDP, DeepSpeed, and FSDP with a consistent API.
  • Automatic device placement and precision: Handle FP16/BF16/FP8 with correct backward behavior via accelerator utilities.
  • Practical performance knobs: Configure gradient accumulation, DeepSpeed ZeRO, and FSDP sharding through plugins and config.

Quick Start

Ask your agent to convert your existing PyTorch training loop to use Accelerate by adding an Accelerator instance, wrapping your model/optimizer/dataloader with accelerator.prepare(), and replacing loss.backward() with accelerator.backward(loss) before launching with accelerate launch train.py.

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 single-GPU PyTorch training script to multi-GPU without rewriting core logic?

To convert single-GPU PyTorch training to multi-GPU, add an Accelerator instance, wrap your model/optimizer/dataloader with accelerator.prepare(), and replace loss.backward() with accelerator.backward(loss) to enable distributed training.

Does HuggingFace Accelerate support mixed precision training with FP16 and BF16?

Yes, HuggingFace Accelerate supports mixed precision training by abstracting FP16, BF16, and FP8 device placement and synchronization, automatically handling correct backward behavior via accelerator utilities.

Can I run the same PyTorch training code across DDP, DeepSpeed ZeRO, and FSDP sharding configurations?

Yes, you can run the same PyTorch training code across DDP, DeepSpeed ZeRO, and FSDP sharding using the unified distributed launcher, configuring specific sharding behaviors through DeepSpeedPlugin or FullyShardedDataParallelPlugin.

What is the best way to configure gradient accumulation for distributed training?

The best way to configure gradient accumulation for distributed training is through the Accelerate config and plugins, which handles synchronization automatically alongside your mixed precision and sharding setup.

Do I need to manually set up device placement for multi-node PyTorch training?

No, you do not need to manually set up device placement for multi-node PyTorch training, as Accelerate abstracts device placement, synchronization, and launcher setup behind its API.

How does the accelerate launch command automate multi-GPU training workflows?

The accelerate launch command automates multi-GPU training by executing your prepared script with the correct launcher setup, seamlessly handling the distributed environment configuration defined in your Accelerate config.