huggingface-accelerate

Convert PyTorch training scripts to HuggingFace Accelerate distributed runs.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates the complexity of writing separate distributed-training codepaths by providing a unified, minimal-change API for multi-GPU and advanced training setups.

Core Features & Use Cases

  • Unified distributed training API: Wraps models, optimizers, and dataloaders so you can scale with the same training loop across DDP, DeepSpeed, FSDP, and Megatron-LM scenarios.
  • Mixed precision and performance options: Enables FP16/BF16/FP8 and supports gradient accumulation, checkpointing, and common tuning knobs.
  • Practical workflows: Use cases include converting an existing PyTorch script to run on any hardware, configuring multi-node launches, and integrating ZeRO/FSDP strategies without rewriting core logic.

Quick Start

Install and run distributed training by telling an AI: "Convert my PyTorch training script to use HuggingFace Accelerate for multi-GPU training, then generate the exact updated code and the single 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 training script to run distributed training across multiple GPUs?

To convert a PyTorch script for distributed training, wrap models, optimizers, and dataloaders with an Accelerator object using accelerator.prepare(). This allows the same training loop to scale across single GPU, multi-GPU, and multi-node environments with minimal code changes.

Can I use mixed precision training with FP16 or BF16 when scaling PyTorch models?

Yes, mixed precision training with FP16, BF16, or FP8 is fully supported. You can enable these precision options alongside gradient accumulation and checkpointing to optimize performance without rewriting your core training logic.

What is the best way to switch between DDP, FSDP, and DeepSpeed ZeRO parallelism patterns?

The best way to switch between DDP, FSDP, and DeepSpeed ZeRO is by using plugin-based settings during configuration. This unified API manages the underlying parallelism patterns so you can change strategies without altering the core training loop.

Does HuggingFace Accelerate work with multi-node environments and Megatron-LM?

Yes, it supports scaling across multi-node environments and integrates with Megatron-LM parallelism patterns. You can configure multi-node launches and apply advanced distributed strategies using the accelerate launch workflow.

Why do I need to use accelerator.backward() instead of standard loss.backward() for distributed training?

You need accelerator.backward() because it properly handles gradient synchronization across distributed processes. Replacing standard loss.backward() ensures gradients are correctly managed when scaling across multiple GPUs or nodes.

When should I not use a unified distributed training API for my PyTorch models?

You should not use a unified distributed API if your training scenario requires highly customized CUDA device logic or specialized hardware configurations that fall outside standard DDP, FSDP, or DeepSpeed ZeRO patterns.