2

I am using Huggingface's Transformers Trainer object and I really like the support it has for wandb.

For my use case, I have subclassed the Trainer and, in addition to the values that are logged by default, I would like to keep track of one additional variable that gets updated at each training step.

What is the easiest way to add tracking for a single variable with wandb?

ClonedOne
  • 569
  • 4
  • 20
  • 1
    Wherever the variable is updated, do `wandb.log({'my_variable': variable})`. You might just want to make sure that the x-axis is aligned properly. Usually, we use `wandb.log({'a': a}, commit=False)` to first accumulate all the variables to be logged and finally call `wandb.log` with `commit=True`. However, in your case, you might not be able to do this since wandb logger is logging outside of your subclassed Trainer. Try using `wandb.define_metrics` to set a custom x-axis. Docs: https://docs.wandb.ai/guides/track/log#customize-axes-and-summaries-with-define_metric – ayush thakur Mar 15 '22 at 06:19

0 Answers0