Skip to content

Commit

Permalink
set eval_strategy from config
Browse files Browse the repository at this point in the history
  • Loading branch information
winglian committed Sep 10, 2023
1 parent a94f9cb commit 1568935
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/axolotl/utils/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,20 +556,24 @@ def setup_trainer(cfg, train_dataset, eval_dataset, model, tokenizer, total_num_
"sample_packing_efficiency"
] = cfg.sample_packing_eff_est

if cfg.val_set_size == 0:
if cfg.eval_steps and cfg.evaluation_strategy:
training_arguments_kwargs["evaluation_strategy"] = cfg.evaluation_strategy
training_arguments_kwargs["eval_steps"] = cfg.eval_steps
elif cfg.val_set_size == 0:
training_arguments_kwargs["evaluation_strategy"] = "no"
elif cfg.eval_steps:
elif cfg.eval_steps and isinstance(cfg.eval_steps, int):
training_arguments_kwargs["evaluation_strategy"] = "steps"
training_arguments_kwargs["eval_steps"] = cfg.eval_steps
else:
# we have an eval set, but no steps defined, use epoch
training_arguments_kwargs["evaluation_strategy"] = "epoch"
if cfg.eval_steps and isinstance(cfg.eval_steps, float):
training_arguments_kwargs["eval_steps"] = cfg.eval_steps

if cfg.save_strategy:
training_arguments_kwargs["save_strategy"] = cfg.save_strategy
else:
training_arguments_kwargs["save_strategy"] = (
"steps" if cfg.save_steps else "epoch"
"steps" if cfg.save_steps and isinstance(cfg.save_steps, int) else "epoch"
)

if cfg.do_bench_eval:
Expand Down

0 comments on commit 1568935

Please sign in to comment.