Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.wandb.ai/llms.txt

Use this file to discover all available pages before exploring further.

To log metrics on two different time scales, log indices like batch and epoch alongside your metrics. For example, you might log training accuracy per batch and validation accuracy per epoch. Call run.log({'train_accuracy': 0.9, 'batch': 200}) in one step and run.log({'val_accuracy': 0.8, 'epoch': 4}) in another. In the UI, set the value you want as the x-axis for each chart. To set a default x-axis for a specific index, use Run.define_metric(). For the preceding example, use the following code:
import wandb

with wandb.init() as run:
    run.define_metric("batch")
    run.define_metric("epoch")

    run.define_metric("train_accuracy", step_metric="batch")
    run.define_metric("val_accuracy", step_metric="epoch")

Experiments Metrics