Merge pull request #167 from NanoCode012/fix/redundant-save-eval-steps
Browse files
src/axolotl/utils/trainer.py
CHANGED
@@ -62,8 +62,6 @@ def setup_trainer(cfg, train_dataset, eval_dataset, model, tokenizer):
|
|
62 |
if cfg.logging_steps is not None
|
63 |
else max(min(int(0.005 * total_num_steps), 10), 1)
|
64 |
)
|
65 |
-
save_steps = cfg.save_steps
|
66 |
-
eval_steps = cfg.eval_steps
|
67 |
|
68 |
training_arguments_kwargs = {}
|
69 |
if cfg.bf16 == "full":
|
@@ -123,16 +121,16 @@ def setup_trainer(cfg, train_dataset, eval_dataset, model, tokenizer):
|
|
123 |
num_train_epochs=cfg.num_epochs,
|
124 |
learning_rate=cfg.learning_rate,
|
125 |
evaluation_strategy="steps" if cfg.val_set_size > 0 else "no",
|
126 |
-
save_strategy="steps" if save_steps else "epoch",
|
127 |
-
eval_steps=eval_steps if cfg.val_set_size > 0 else None,
|
128 |
-
save_steps=save_steps,
|
129 |
output_dir=cfg.output_dir,
|
130 |
save_total_limit=3,
|
131 |
load_best_model_at_end=(
|
132 |
cfg.load_best_model_at_end is not False
|
133 |
and cfg.val_set_size > 0
|
134 |
-
and save_steps
|
135 |
-
and save_steps % eval_steps == 0
|
136 |
and cfg.load_in_8bit is not True
|
137 |
)
|
138 |
or False,
|
|
|
62 |
if cfg.logging_steps is not None
|
63 |
else max(min(int(0.005 * total_num_steps), 10), 1)
|
64 |
)
|
|
|
|
|
65 |
|
66 |
training_arguments_kwargs = {}
|
67 |
if cfg.bf16 == "full":
|
|
|
121 |
num_train_epochs=cfg.num_epochs,
|
122 |
learning_rate=cfg.learning_rate,
|
123 |
evaluation_strategy="steps" if cfg.val_set_size > 0 else "no",
|
124 |
+
save_strategy="steps" if cfg.save_steps else "epoch",
|
125 |
+
eval_steps=cfg.eval_steps if cfg.val_set_size > 0 else None,
|
126 |
+
save_steps=cfg.save_steps,
|
127 |
output_dir=cfg.output_dir,
|
128 |
save_total_limit=3,
|
129 |
load_best_model_at_end=(
|
130 |
cfg.load_best_model_at_end is not False
|
131 |
and cfg.val_set_size > 0
|
132 |
+
and cfg.save_steps
|
133 |
+
and cfg.save_steps % cfg.eval_steps == 0
|
134 |
and cfg.load_in_8bit is not True
|
135 |
)
|
136 |
or False,
|