Unverified Commit 80e4184f authored by abhishek thakur's avatar abhishek thakur Committed by GitHub
Browse files

on_log event should occur *after* the current log is written (#9872)

parent 15e4ce35
...@@ -680,7 +680,7 @@ class Trainer: ...@@ -680,7 +680,7 @@ class Trainer:
self, self,
resume_from_checkpoint: Optional[str] = None, resume_from_checkpoint: Optional[str] = None,
trial: Union["optuna.Trial", Dict[str, Any]] = None, trial: Union["optuna.Trial", Dict[str, Any]] = None,
**kwargs **kwargs,
): ):
""" """
Main training entry point. Main training entry point.
...@@ -1248,9 +1248,9 @@ class Trainer: ...@@ -1248,9 +1248,9 @@ class Trainer:
if self.state.epoch is not None: if self.state.epoch is not None:
logs["epoch"] = round(self.state.epoch, 2) logs["epoch"] = round(self.state.epoch, 2)
self.control = self.callback_handler.on_log(self.args, self.state, self.control, logs)
output = {**logs, **{"step": self.state.global_step}} output = {**logs, **{"step": self.state.global_step}}
self.state.log_history.append(output) self.state.log_history.append(output)
self.control = self.callback_handler.on_log(self.args, self.state, self.control, logs)
def _prepare_inputs(self, inputs: Dict[str, Union[torch.Tensor, Any]]) -> Dict[str, Union[torch.Tensor, Any]]: def _prepare_inputs(self, inputs: Dict[str, Union[torch.Tensor, Any]]) -> Dict[str, Union[torch.Tensor, Any]]:
""" """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment