From 80e4184fb06f54b80441fc7b35a07051a23dabe5 Mon Sep 17 00:00:00 2001 From: abhishek thakur Date: Thu, 28 Jan 2021 19:11:04 +0100 Subject: [PATCH] on_log event should occur *after* the current log is written (#9872) --- src/transformers/trainer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transformers/trainer.py b/src/transformers/trainer.py index fca67c7b4a3..3e62db7690b 100755 --- a/src/transformers/trainer.py +++ b/src/transformers/trainer.py @@ -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]]: """