Fixing a small issue in trainer logging (#1563)

* The epoch was being logged to metrics, which isn't read, rather than to current_metrics.

* Updated the tests to account for the epoch arriving at the logger.
This commit is contained in:
Guy Davidson
2020-04-23 17:52:41 -04:00
committed by GitHub
parent 7989ca844c
commit fe2b6666e0
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ class TrainerLoggingMixin(ABC):
step = scalar_metrics.pop("step")
else:
# added metrics by Lightning for convenience
metrics['epoch'] = self.current_epoch
scalar_metrics['epoch'] = self.current_epoch
step = step if step is not None else self.global_step
# log actual metrics
if self.proc_rank == 0 and self.logger is not None:
+3 -3
View File
@@ -62,9 +62,9 @@ def test_loggers_fit_test(tmpdir, monkeypatch, logger_class):
trainer.test()
log_metric_names = [(s, sorted(m.keys())) for s, m in logger.history]
assert log_metric_names == [(0, ['val_acc', 'val_loss']),
(0, ['train_some_val']),
(1, ['test_acc', 'test_loss'])]
assert log_metric_names == [(0, ['epoch', 'val_acc', 'val_loss']),
(0, ['epoch', 'train_some_val']),
(1, ['epoch', 'test_acc', 'test_loss'])]
@pytest.mark.parametrize("logger_class", [