Skip to content

Commit 5f29239

Browse files
authored
Bug fix hparam logging with metrics (Lightning-AI#1647)
* add metric logging * Use pytorch built-in method * Update tensorboard.py * Update tensorboard.py
1 parent 35ac30e commit 5f29239

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pytorch_lightning/loggers/tensorboard.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def log_hyperparams(self, params: Union[Dict[str, Any], Namespace],
115115
)
116116
else:
117117
from torch.utils.tensorboard.summary import hparams
118+
118119
if metrics is None:
119120
metrics = {}
120121
exp, ssi, sei = hparams(sanitized_params, metrics)
@@ -123,6 +124,10 @@ def log_hyperparams(self, params: Union[Dict[str, Any], Namespace],
123124
writer.add_summary(ssi)
124125
writer.add_summary(sei)
125126

127+
if metrics:
128+
# necessary for hparam comparison with metrics
129+
self.log_metrics(metrics)
130+
126131
# some alternative should be added
127132
self.tags.update(sanitized_params)
128133

0 commit comments

Comments
 (0)