mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-09 11:32:07 +08:00
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:
@@ -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:
|
||||
|
||||
@@ -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", [
|
||||
|
||||
Reference in New Issue
Block a user