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

This commit is contained in:
abhishek thakur 2021-01-28 19:11:04 +01:00 committed by GitHub
parent 15e4ce353a
commit 80e4184fb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -680,7 +680,7 @@ class Trainer:
self,
resume_from_checkpoint: Optional[str] = None,
trial: Union["optuna.Trial", Dict[str, Any]] = None,
**kwargs
**kwargs,
):
"""
Main training entry point.
@ -1248,9 +1248,9 @@ class Trainer:
if self.state.epoch is not None:
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}}
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]]:
"""