Hugging Face Accelerate is a library that enables the same PyTorch code to run across any distributed configuration, to simplify model training and inference at scale. Accelerate includes a W&B Tracker, which this page shows how to use to log metrics, configuration, and artifacts from distributed training runs to W&B. For more information, see Accelerate Trackers in Hugging Face.Documentation Index
Fetch the complete documentation index at: https://wb-21fd5541-style-guide-models-integrations-20260527-015516.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Start logging with Accelerate
This section shows how to configure Accelerate to log experiment data to W&B during training. To get started with Accelerate and W&B, follow this pseudocode:- Pass
log_with="wandb"when you initialize theAcceleratorclass. - Call the
init_trackersmethod and pass it:- A project name via
project_name. - Any parameters you want to pass to
wandb.init()through a nested dict toinit_kwargs. - Any other experiment config information you want to log to your wandb run, through
config.
- A project name via
- Use the
wandb.Run.log()method to log to W&B. Thestepargument is optional. - Call
.end_training()when training finishes.
Access the W&B tracker
Once Accelerate logs to W&B, you may want direct access to the underlying W&B run object to log artifacts, custom charts, or other data that the tracker doesn’t expose. To access the W&B tracker, use theAccelerator.get_tracker() method. Pass in the string corresponding to a tracker’s .name attribute, which returns the tracker on the main process.
wandb run object as usual: