Different values for indices for a sequence of logged images when wandb is synced with tensorboard

HI all,

I’m working on a nerf-like project and trying manage the experiment results on wandb synced with tensorboard. What I have coded is logging several loss values at every training step, and predicting image later as shown below:

project = "test_sync_tb"
group = "test_group"
job_type = "test_job_type"
run_name = "test_run"
logdir = f"_results/{project}/{group}/{job_type}"
wandb.tensorboard.patch(root_logdir=logdir, pytorch=True)


os.makedirs(logdir, exist_ok=True)
wandb.init(
    dir=logdir,
    project=project,
    group=group,
    job_type=job_type,
    sync_tensorboard=True
)


writer = torch.utils.tensorboard.SummaryWriter(logdir)


num_training_steps = 10
for i in range(num_training_steps):
    for j in range(3):
        writer.add_scalar(f"test_training/loss_{j}", i / (j + 1), i)

num_images = 5
h = w = 256
for i in range(num_images):
    writer.add_image(
        "predicted_images", np.random.rand(h, w, 3), i, dataformats="HWC")


writer.close()
wandb.finish()

WandB summarized the results well except for one thing. I expect the indices for the sequence of predicted images should span from 0 to 4 since those values are passed to add_image() as `global_step. But as shown in the image below, The indices were 9 to 13.

How can I make the indices start from 0 instead of 9?

Thanks in advance!

Hello @barikata1984 !

We currently don’t support changing the step slider steps to be changed from the wandb step to the global_step. However, we have been requested before for this feature so I can add you to the list of requesters. Also, there has been an offered workaround here if that is something that may be useful to you.

Hi @raphael-sanandres,

Thanks for your reply. I’ll take a look into it, and hope some solid solution will be provided soon :slightly_smiling_face:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.