diff --git a/src/transformers/trainer.py b/src/transformers/trainer.py index ea5e25a128d5a3..0ba5c6948c713c 100755 --- a/src/transformers/trainer.py +++ b/src/transformers/trainer.py @@ -2892,10 +2892,7 @@ def _determine_best_metric(self, metrics, trial): f"The available evaluation metrics are: {list(metrics.keys())}. Consider changing the `metric_for_best_model` via the TrainingArguments." ) from exc - if self.args.greater_is_better: - operator = np.greater - else: - operator = np.less + operator = np.greater if self.args.greater_is_better else np.less else: metric_value = metrics["eval_loss"] operator = np.less