WandB – Why are "step" ticks in diagrams calculated differently from given? (Python)

Question:

I evaluate a deep learning model (StyleGan2-Ada-Pytorch). The procedure is to calculate the metrics afterwards based on a log file (this takes a long time, therefore not done in training).

The metric was logged only every few iterations, so epoch is something like 0, 50, 100, 150 and has each time a corresponding metric.
I iterate through the list and give each item to WandB: wandb.log( metric, step=epoch )

Problem: When looking at the overall WandB dashboard, the data points are not on the given step (x-axis tick). They are off by some scaled delta. For example: Instead of starting at the given 0 step, the value is displayed at position 19.6. This differs for every entry:

epoch tick (step) diagram x-position delta
0 +19.6 (see screenshot)
50 +9.8
100 0
150 -9.8
200 -19.6

overview dashboard

But, when I click on the specific run to view its details, the values are displayed correctly:
detail dashboard

I tried to play with the axis scales, smoothing and so on. Did not help.

This is super annoying, has somebody an idea what’s wrong?


Minimal Example:

import os
import wandb
os.environ["WANDB_API_KEY"] = 'Your API Key'

step_metric = {
    0  : 2.2,
    50 : 29.3,
    100: 45,
    150: 67.4,
    200: 182
}

run = wandb.init(  project = "stackoverflow", group = 'run1'  )

for key, value in step_metric.items():
    mydict = { "A": value , "B" : value*2 }
    wandb.log( mydict, step=int(key) )

run.finish()
Asked By: vii

||

Answers:

One of the devs responded to my issue.
They state to avoid using the step parameter and insert it instead as an extra property in the values dict.
(I personally think it’s currently a bug)

Updated code:

    mydict = { "A": value , "B" : value*2, epoch=int(key) }
    wandb.log( mydict )

Change the x-axis in the diagram afterwards:

wandb

Answered By: vii
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.