0

I am using Weights & Biases (wandb) for logging metrics in my training script. I have a training loop where I calculate train_loss and val_loss and want to log these metrics so that they both appear in the same panel on the wandb dashboard.

Here is the snippet of my code:

import numpy as np
import wandb

wandb.init(project="test")

for i in range(100):
    # Training step
    train_loss = 0.5 + i / 1000 + 0.01 * np.random.random()
    # Validation step
    val_loss = 0.5 - i /1000 + 0.01 * np.random.random()
    # Log metrics
    wandb.log({"train_loss": train_loss, "val_loss": val_loss})

wandb.finish()

Here is what the code above produces: current output (two plots)

This is what I would like to generate using Python only: desired output (one combined plot)

Even though I am logging both metrics in the same dictionary, they still appear in two different panels in the wandb dashboard.

I know that I can manually configure the dashboard to display these two metrics in the same plot, but I would like to have them plotted in the same panel by default, through the code.

Is there a way to configure this directly within the script so that train_loss and val_loss are plotted together in the same panel automatically?

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Luca
  • 1
  • 2

0 Answers0