Skip to content

[BUG] Unexpected use of step in WandbLogger #2998

Open
@itwasabhi

Description

@itwasabhi

Describe the bug

When logging scalars, the wandb logger passes the provided step to a "train/step" key instead of wandbs global step:

        if step is not None:
            self.experiment.log({name: value, "trainer/step": step})
        else:
            self.experiment.log({name: value})

This is an odd choice as it triggers wandb's internal auto-incrementing: https://github.com/wandb/wandb/blob/v0.20.1/wandb/sdk/wandb_run.py#L1812

This can cause a bit of a headache, particularly when there are multiple users of the same logger through a training loop.

Expected behavior

I think the simplest approach for torchrl would be pass in the step as wandb intended:

self.experiment.log({name: value}, step=step)

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have read the documentation (required)
  • I have provided a minimal working example to reproduce the bug (required)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions