huggingface-accelerate

Abstract device placement, process launching, mixed precision for PyTorch training scripts.

Updated May 26, 2026
One-click install
npx skills add https://github.com/ruiyangruiyi/hermes-agent --skill huggingface-accelerate-ruiyangruiyi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: huggingface-accelerate
Source: https://github.com/ruiyangruiyi/hermes-agent/tree/main/optional-skills/mlops/accelerate
Command: npx skills add https://github.com/ruiyangruiyi/hermes-agent --skill huggingface-accelerate-ruiyangruiyi

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

HuggingFace Accelerate removes the complexity of writing separate distributed-training scripts for DDP, DeepSpeed, FSDP, and mixed precision by letting you run the same PyTorch code across different hardware setups with minimal changes.

Core Features & Use Cases

  • Unified distributed training API: The same training loop can be prepared to run on single GPU, multi-GPU, multi-node, and TPU-like environments.
  • Automatic device placement & mixed precision: Handles FP16/BF16/FP8 workflows without requiring you to manually manage autocast and backward scaling in typical cases.
  • Strategy plug-ins for scaling: Integrates with DeepSpeed ZeRO (stages 2/3), FSDP sharding, and Megatron-LM-style parallelism through Accelerate plugins.
  • Common use case: Convert an existing Transformer training script that works on one GPU into a multi-GPU, mixed-precision workflow that scales to larger models (including DeepSpeed ZeRO-2/3 or FSDP) with minimal code edits.

Quick Start

Run your training script with distributed support by using the command: 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 run PyTorch distributed training on multiple GPUs without rewriting my script?

You can run PyTorch distributed training across multiple GPUs without rewriting your script by using the Accelerate API to wrap your existing training loop and launching it with the accelerate launch command.

What is the easiest way to add mixed precision training to a Hugging Face Transformers script?

The easiest way to add mixed precision training is using Accelerate's Accelerator API, which automatically handles FP16, BF16, or FP8 device placement and backward scaling without requiring manual autocast management.

Can I use DeepSpeed ZeRO stages 2 and 3 with my existing PyTorch training loop?

Yes, you can integrate DeepSpeed ZeRO stages 2 and 3 with your existing PyTorch training loop by utilizing Accelerate's strategy plug-ins, allowing large model scaling with minimal code edits.

Does FSDP sharding require manually managing device placement in PyTorch?

FSDP sharding does not require manually managing device placement in PyTorch when using Accelerate, as it abstracts away device placement mechanics and handles the distributed wrapping automatically.

What is the best way to scale a single GPU Transformer model to multi-node training?

The best way to scale a single GPU Transformer model to multi-node training is using Accelerate's unified API to prepare your script for distributed backends, enabling multi-GPU and multi-node scaling with minimal code changes.

Do I need to write separate scripts for TPU and multi-GPU mixed precision training?

You do not need to write separate scripts for TPU and multi-GPU mixed precision training; Accelerate lets you run the same PyTorch code across different hardware setups by abstracting the process launching and precision mechanics.