Logging dictionary from Pytorch Lightning Logger

When logging using the W&B Callback, a call to self.log() will only take scalars (the call won’t fail, it just won’t show up in the W&B plots). I’d like to to something like the following:

Using the standard PL log call:
self.log(name='my_metrics', value={ 'a': 1, 'b':2} ).
and have nice plots show up auto-magically with all these plots on the same axis or in the same tab.

Currently I am simply looping through my dict and logging them as scalars manually

Note I would like to avoid unpacking the the W&B logger from the PL Trainer, and calling it directly.
wandb = self.logger.experiment

I haven’t tested this, but I assume it would work. But it would make my code messy and dependent on knowledge of whether I was using W&B for a particular run.

Sorry for not replying @max_wasserman. Thanks for passing these requests on, I agree that it would be nice to be able to pass a dict using the standard PL call. I’ll pass this request on to the owners of the PL integration and see what they think about adding that call.

Turns out this feature already exists and I didn’t know.
Here’s how to log a dict with PyTorch Lightning: LightningModule — PyTorch Lightning 1.5.0rc0 documentation

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