Is there a way to add metric to progress bar without calling `log`?

Hello. I am using MLFlow to log my metrics and using a line such as:

self.logger.experiment.log_metric("val_acc", val_acc, step=self.current_epoch)

because I would like to specify the step argument, I have to use the logger object directly. However, this means I cannot use the prog_bar argument like I can if I had just directly called log e.g.

self.log("val_acc", val_acc, on_step=False, on_epoch=True, prog_bar=True)

How do I go about putting the metric on the progress bar while using self.logger.experiment.log_metric(...)?

Thank you.

Hey @tomgwasira

You can just make a self.log call just for the progress bar in addition to your logger call, like so:

self.log("val_acc", val_acc, ..., logger=False, prog_bar=True)

The combination logger=False and prog_bar=True ensures that your metric value only logs to the progress bar.

1 Like