David Meikle commited on
Commit
3c00f40
1 Parent(s): a7a9a14

Allow load_best_model_at_end to be configured for early stopping on custom evaluation datasets (#1291)

Browse files

* Allow load_best_model_at_end when using test_datasets and val_set_size is zero for custom evaluation datasets

* Fixed formatting following failed Lint check

src/axolotl/core/trainer_builder.py CHANGED
@@ -883,8 +883,10 @@ class HFCausalTrainerBuilder(TrainerBuilderBase):
883
  self.cfg.load_best_model_at_end is not False
884
  or self.cfg.early_stopping_patience
885
  )
886
- and not self.cfg.test_datasets
887
- and self.cfg.val_set_size > 0
 
 
888
  and self.cfg.save_steps
889
  and self.cfg.eval_steps
890
  and self.cfg.save_steps % self.cfg.eval_steps == 0
 
883
  self.cfg.load_best_model_at_end is not False
884
  or self.cfg.early_stopping_patience
885
  )
886
+ and (
887
+ (not self.cfg.test_datasets and self.cfg.val_set_size > 0)
888
+ or (self.cfg.test_datasets and self.cfg.val_set_size == 0)
889
+ )
890
  and self.cfg.save_steps
891
  and self.cfg.eval_steps
892
  and self.cfg.save_steps % self.cfg.eval_steps == 0