I am using Pytorch Lightning to train my models (on GPU devices, using DDP) and TensorBoard is the default logger used by Lightning.
My code is setup to log the training and validation loss on each training and validation step respectively.
class MyLightningModel(pl.LightningModule):
def training_step(self, batch):
x, labels = batch
out = self(x)
loss = F.mse_loss(out, labels)
self.log("train_loss", loss)
return loss
def validation_step(self, batch):
x, labels = batch
out = self(x)
loss = F.mse_loss(out, labels)
self.log("val_loss", loss)
return loss
TensorBoard correctly plots both the train_loss and val_loss charts in the SCALERS tab. However, in the HPARAMS tab, on the left side bar, only hp_metric is visible under Metrics.
However, in the HPARAMS tab, on the left side bar, only hp_metric is visible under Metrics.
How can we add train_loss and val_loss to the Metrics section? This way, we will be able to use val_loss in the PARALLEL COORDINATES VIEW instead of hp_metric.
Image showing hp_metric and no val_loss:

Using Pytorch 1.8.1, Pytorch Lightning 1.2.6, TensorBoard 2.4.1

