fairseq icon indicating copy to clipboard operation
fairseq copied to clipboard

How can I add a histogram of weights to tensorboard

Open qmeeus opened this issue 3 years ago • 0 comments

Hi

I would like to add a vector of weights to tensorboard summary during training. However, I am having a hard time figuring out how to do that. From what I understand, logging to tensorboard is handled by fairseq.logging.progress_bar.TensorboardProgressBarWrapper._log_to_tensorboard which receives the output of the criterion's forward function. However, there is no way to add_histogram instead, as all output stats are either passed to TB with add_scalar or ignored.

Is there an underlying reason to preventing adding histograms that I am missing?

If not, what is my best course of action for adding this functionality? I guess it starts with subclassing the criterion to return the correct additional quantities to log and subclassing TensorboardProgressBarWrapper and overwite _log_to_tensorboard. Also, how can I make sure that the histogram values are only used in TB and not in stdout? Finally, is there support for custom progress bar or should I modify the train script as well?

Thank you very much

qmeeus avatar Oct 06 '22 08:10 qmeeus