diff --git a/keras/callbacks.py b/keras/callbacks.py index 8702ae1c60e..bac76a821d8 100644 --- a/keras/callbacks.py +++ b/keras/callbacks.py @@ -2889,8 +2889,14 @@ def _log_epoch_metrics(self, epoch, logs): if not logs: return - train_logs = {k: v for k, v in logs.items() if not k.startswith("val_")} - val_logs = {k: v for k, v in logs.items() if k.startswith("val_")} + train_logs = dict() + val_logs = dict() + for k, v in logs.items(): + if k.startswith("val_"): + val_logs[k] = v + else: + train_logs[k] = v + train_logs = self._collect_learning_rate(train_logs) if self.write_steps_per_second: train_logs["steps_per_second"] = self._compute_steps_per_second()