Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 5 min read Release mediumAdept

Accelerate 1.0.0

Hugging Face has published the first release candidates for Accelerate 1.0.0. The library has grown from a thin multi-GPU/TPU training-loop wrapper into the base layer for transformers, diffusers, peft and trl, covering six accelerator types, a launch CLI and big-model inference via device_map="auto". Before 1.0 the team added FP8 support through MS-AMP and TransformerEngine, multi-model DeepSpeed orchestration, torch.compile for big model inference, torch.distributed.pipelining and StatefulDataLoader. Migration notes list the breaking deprecations, such as moving dataloader flags into DataLoaderConfiguration, using AutocastKwargs and renaming is_tpu_available to is_torch_xla_available.

Related posts

  • Introducing 🤗 Accelerate

    Hugging Face mediumAdept

    🤗 Accelerate lets PyTorch users keep their own training loops while running the same script on CPU, single or multi-GPU, multi-node, TPU, and with mixed precision, by adding about five lines: an Accelerator object, accelerator.prepare() for model/optimizer/dataloader, and accelerator.backward(). prepare() wraps the model in the right container such as DistributedDataParallel, wraps the optimizer for mixed precision, and shards any sampler's indices per process using synchronized RNGs instead of requiring DistributedSampler. Distributed evaluation uses accelerator.gather plus truncation of padded batches. An `accelerate config` / `accelerate launch` CLI replaces torch.distributed.launch arguments and can target SageMaker.

  • From PyTorch DDP to Accelerate to Trainer, mastery of distributed training with ease

    Hugging Face mediumAdept

    Converting a basic PyTorch MNIST training script to multi-GPU Distributed Data Parallel training is shown at three levels of abstraction. The first is native torch.distributed with process-group setup, a DDP wrapper and the torchrun launcher. The second is Hugging Face Accelerate's Accelerator.prepare, which keeps the loop nearly unchanged, runs on single GPU, multi-GPU or TPU, and shards batches through custom samplers so only one copy of the dataset sits in memory. The third is the Transformers Trainer, which needs only a custom collate function and compute_loss override, and any of these can be launched from Jupyter via notebook_launcher.

  • Parameter-Efficient Fine-Tuning using 🤗 PEFT

    Hugging Face mediumAdept

    Hugging Face's PEFT library brings parameter-efficient fine-tuning methods (LoRA, Prefix Tuning, Prompt Tuning, P-Tuning) to Transformers and Accelerate. Most pretrained weights stay frozen and only a small set of extra parameters is trained, which gives performance comparable to full fine-tuning at a fraction of the compute and storage cost. A LoRA config on mt0-large trains about 0.19% of the parameters, and the saved adapters are only a few MB (19MB for T0_3B) instead of 40GB per-task checkpoints. Example use cases include tuning T0_3B on 11GB consumer GPUs with DeepSpeed offload, INT8 tuning of OPT-6.7b in Colab with bitsandbytes, and Stable Diffusion Dreambooth, plus code for training, saving and loading adapters.

  • Accelerate Large Model Training using DeepSpeed

    Hugging Face mediumAdept

    Hugging Face Accelerate can enable DeepSpeed ZeRO data parallelism, which shards optimizer states, gradients and parameters across GPUs and optionally offloads them to CPU, with no or minimal code changes. On two 24GB Titan RTX GPUs, ZeRO Stage-2 allowed 5x larger batches than DDP for DeBERTa-XL (900M) and gave about a 3.5x training speedup with no accuracy loss. BlenderBot-400M fine-tuning saw 2x batch size and a ~1.44x training speedup. ZeRO Stage-3 with CPU offload made GPT-2 XL (1.5B) trainable at batch size 16 where DDP ran out of memory even at batch size 1. The post includes the accelerate config, DeepSpeed JSON configs, and the DummyOptim/DummyScheduler changes needed when the optimizer and scheduler are defined in the DeepSpeed config.

  • From DeepSpeed to FSDP and Back Again with Hugging Face Accelerate

    Hugging Face hardMaster

    DeepSpeed ZeRO-3 and PyTorch FSDP gave different training results on Mistral-7B loaded in bfloat16 because DeepSpeed silently upcasts flattened parameters and optimizer state to fp32, while FSDP keeps them in the loaded dtype. That made the same learning rate converge on one backend and stall on the other. Hugging Face Accelerate 0.30.0 adds automatic fp32 upcasting for FSDP when mixed precision is enabled, so FSDP can run either in a DeepSpeed-like mixed-precision mode or in a low-precision mode for memory-constrained setups. In that aligned mode, throughput on four A100s with Granite 7B is roughly equal: about 3159 vs 3095 tokens/sec/GPU and an MFU of 0.41 vs 0.40.

The quest for software engineering knowledge.

Look:
Layout: