Skip to content

Commit a98526e

Browse files
add support for include_tokens_per_second in training args (#2269)
* add support for include_tokens_per_second in training args * Update docs/config.qmd Co-authored-by: NanoCode012 <nano@axolotl.ai> * Update src/axolotl/core/trainer_builder.py Co-authored-by: NanoCode012 <nano@axolotl.ai> --------- Co-authored-by: NanoCode012 <nano@axolotl.ai>
1 parent 2e57391 commit a98526e

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

docs/config.qmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ save_total_limit: # Checkpoints saved at a time
390390
# e.g., when 1 epoch is 1000 steps => `num_epochs: 2` and `max_steps: 100` will train for 100 steps
391391
max_steps:
392392

393+
# bool of whether to include tokens trainer per second in the training metrics. This iterates over the entire dataset once, so it takes some time.
394+
include_tokens_per_second:
395+
393396
eval_table_size: # Approximate number of predictions sent to wandb depending on batch size. Enabled above 0. Default is 0
394397
eval_max_new_tokens: # Total number of tokens generated for predictions sent to wandb. Default is 128
395398
eval_causal_lm_metrics: # HF evaluate metrics used during evaluation. Default is ["sacrebleu", "comet", "ter", "chrf", "perplexity"]

src/axolotl/core/trainer_builder.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,12 @@ def build(self, total_num_steps):
330330
)
331331

332332
training_arguments_kwargs = {}
333+
334+
if self.cfg.include_tokens_per_second is not None:
335+
training_arguments_kwargs[
336+
"include_tokens_per_second"
337+
] = self.cfg.include_tokens_per_second
338+
333339
if self.cfg.bf16 == "full":
334340
training_arguments_kwargs["bf16_full_eval"] = True
335341
else:

src/axolotl/utils/config/models/input/v0_4_1/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ class Config:
844844
save_only_model: Optional[bool] = False
845845
use_tensorboard: Optional[bool] = None
846846
profiler_steps: Optional[int] = None
847+
include_tokens_per_second: Optional[bool] = None
847848

848849
neftune_noise_alpha: Optional[float] = None
849850

0 commit comments

Comments
 (0)