Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def log_metrics(self, metrics: _OUT_DICT, step: Optional[int] = None) -> None:
if step is None:
# added metrics for convenience
scalar_metrics.setdefault("epoch", self.trainer.current_epoch)
step = self.trainer.fit_loop.epoch_loop._batches_that_stepped
step = self.trainer.global_step - 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't BC if multiple optimizers are used.
similar issue: #12274

we need to come up with a better solution.


# log actual metrics
for logger in self.trainer.loggers:
Expand Down
4 changes: 2 additions & 2 deletions tests/tests_pytorch/loggers/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ def log_metrics(self, metrics, step):
expected = [
(0, ["epoch", "train_some_val"]),
(0, ["early_stop_on", "epoch", "val_loss"]),
(1, ["epoch", "test_loss"]),
(0, ["epoch", "test_loss"]),
]
assert log_metric_names == expected
else:
expected = [
(0, ["epoch", "train_some_val"]),
(0, ["early_stop_on", "epoch", "val_loss"]),
(1, ["epoch", "test_loss"]),
(0, ["epoch", "test_loss"]),
]
assert log_metric_names == expected

Expand Down