Skip to content

Commit

Permalink
Allow load_best_model_at_end to be configured for early stopping on c…
Browse files Browse the repository at this point in the history
…ustom evaluation datasets (#1291)

* 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
  • Loading branch information
dameikle authored Feb 21, 2024
1 parent a7a9a14 commit 3c00f40
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/axolotl/core/trainer_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,10 @@ def build(self, total_num_steps):
self.cfg.load_best_model_at_end is not False
or self.cfg.early_stopping_patience
)
and not self.cfg.test_datasets
and self.cfg.val_set_size > 0
and (
(not self.cfg.test_datasets and self.cfg.val_set_size > 0)
or (self.cfg.test_datasets and self.cfg.val_set_size == 0)
)
and self.cfg.save_steps
and self.cfg.eval_steps
and self.cfg.save_steps % self.cfg.eval_steps == 0
Expand Down

0 comments on commit 3c00f40

Please sign in to comment.