Apply several ruff SIM rules (#37283)
* Apply ruff SIM118 fix Signed-off-by: cyy <cyyever@outlook.com> * Apply ruff SIM910 fix Signed-off-by: cyy <cyyever@outlook.com> * Apply ruff SIM101 fix Signed-off-by: cyy <cyyever@outlook.com> * Format code Signed-off-by: cyy <cyyever@outlook.com> * More fixes Signed-off-by: cyy <cyyever@outlook.com> --------- Signed-off-by: cyy <cyyever@outlook.com>
This commit is contained in:
@@ -83,7 +83,7 @@ class TestTrainerExt(TestCasePlus):
|
||||
if not do_eval:
|
||||
self.skipTest(reason="do_eval is False")
|
||||
|
||||
eval_metrics = [log for log in logs if "eval_loss" in log.keys()]
|
||||
eval_metrics = [log for log in logs if "eval_loss" in log]
|
||||
|
||||
first_step_stats = eval_metrics[0]
|
||||
if predict_with_generate:
|
||||
@@ -168,7 +168,7 @@ class TestTrainerExt(TestCasePlus):
|
||||
|
||||
# Check metrics
|
||||
logs = TrainerState.load_from_json(os.path.join(output_dir, "trainer_state.json")).log_history
|
||||
eval_metrics = [log for log in logs if "eval_loss" in log.keys()]
|
||||
eval_metrics = [log for log in logs if "eval_loss" in log]
|
||||
first_step_stats = eval_metrics[0]
|
||||
last_step_stats = eval_metrics[-1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user