This page describes how to use W&B with Ray Tune so you can track hyperparameter tuning trials, log metrics, and compare experiment results across runs. W&B offers two lightweight integrations with Ray, and you can choose the one that best fits your training workflow: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.
- The
WandbLoggerCallbackfunction automatically logs metrics reported to Tune to the W&B API. - The
setup_wandb()function, which you can use with the function API, automatically initializes the W&B API with Tune’s training information. You can use the W&B API as usual, such as by callingrun.log()to log your training process.
Configure the integration
This section describes how to configure theWandbLoggerCallback, which is the most direct way to send Tune trial metrics to W&B.
tune.run(). See the example for usage.
The integration passes the content of the wandb config entry to wandb.init() as keyword arguments. The exceptions are the settings that configure the WandbLoggerCallback itself.
Parameters
TheWandbLoggerCallback accepts the following parameters:
project (str): Name of the W&B project. Required.api_key_file (str): Path to file containing the W&B API key.api_key (str): W&B API key. Alternative to settingapi_key_file.excludes (list): List of metrics to exclude from the log.log_config (bool): Whether to log the config parameter of the results dictionary. Defaults toFalse.upload_checkpoints (bool): IfTrue, uploads model checkpoints as artifacts. Defaults toFalse.
Example
setup_wandb
Usesetup_wandb() when you want direct control over W&B logging from inside your training function, for example, to call run.log() with custom metrics alongside Tune’s reporting.
setup_wandb() in your training function:
Example code
For end-to-end references, see the following examples that show how the integration works:- Try the integration in Colab: A demo to try the integration.
- View the example dashboard: View the dashboard generated from the example.