Skip to content

Commit

Permalink
Refactor and simplify code.
Browse files Browse the repository at this point in the history
Co-authored-by: Zach Mueller <[email protected]>
  • Loading branch information
seanswyi and muellerzr authored Aug 7, 2024
1 parent a114602 commit a2796a7
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2799,10 +2799,7 @@ def _maybe_log_save_evaluate(self, tr_loss, grad_norm, model, trial, epoch, igno
new_best_metric = self._determine_best_metric(metrics=metrics, trial=trial)

if self.args.save_strategy == SaveStrategy.BEST:
if new_best_metric:
self.control.should_save = True
else:
self.control_should_save = False
self.control.should_save = new_best_metric

if self.control.should_save:
self._save_checkpoint(model, trial)
Expand Down

0 comments on commit a2796a7

Please sign in to comment.