Hugging Face's library to run the same PyTorch code on any distributed setup
open sourceApache-2.0free
Accelerate is Hugging Face's library for running the same PyTorch training and inference code on one GPU, several GPUs or machines, TPUs, Apple silicon, Intel CPUs and Gaudi by adding a few lines: an Accelerator object prepares the model, optimizer, data loaders and scheduler. It handles mixed precision including FP8, DeepSpeed, Fully Sharded Data Parallel (FSDP1 and FSDP2), Megatron-LM, gradient accumulation, checkpointing, experiment trackers and big-model inference that loads models larger than memory. Its accelerate command configures and launches distributed scripts, including from Jupyter notebooks and on Amazon SageMaker.
Problems it solves
- run my PyTorch training script on multiple GPUs without rewriting it
- use DeepSpeed or FSDP with PyTorch without lots of boilerplate
- train with mixed precision or FP8 in PyTorch
- launch distributed training from a Jupyter notebook
- load a model that's bigger than my GPU's memory for inference
- move the same training code between CPU, GPU and TPU
Features
- Same PyTorch code on CPU, single and multi-GPU, multi-node and TPU
- Mixed precision including FP8
- DeepSpeed integration
- FSDP1 and FSDP2
- Megatron-LM
- Gradient accumulation and Local SGD
- Checkpointing and experiment trackers
- Big model inference
- accelerate config and launch commands
- Launching from Jupyter notebooks
View 1 more
- Amazon SageMaker, Apple silicon, Intel CPU and Intel Gaudi
Capabilities
| Has a command line tool | plan not known |
|---|---|
| Has official SDKs | plan not known |
Alternatives
The same job
These do what Accelerate does.
- DeepSpeed Deep learning optimization library for training and serving very large models
- PyTorch Lightning Organises PyTorch code and handles the training engineering, from one CPU to thousands of GPUs
- torchtitan A PyTorch-native platform for training generative AI models at scale
- Colossal-AI PyTorch library for distributed training, fine-tuning and inference of large AI models
- Megatron-LM NVIDIA's GPU-optimized library for training transformer models at scale
