How to Log Metrics (eg. Validation Loss, Accuracy) To TensorBoard Hparams?
I am using Pytorch Lightning 1.2.6 to train my models 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
I think it is explained very well in this section of the documentation:
https://pytorch-lightning.readthedocs.io/en/latest/extensions/logging.html#logging-hyperparameters
Basically, you just need to overwrite the hp_metric tag with whatever value you want to show up in the HPARAMS tab in tensorboard.