utils.callbacks.tokens_per_second

utils.callbacks.tokens_per_second

A callback for calculating tokens per second during training.

Classes

Name Description
TokensPerSecondCallback Restore the cumulative token counters when resuming from a checkpoint.

TokensPerSecondCallback

utils.callbacks.tokens_per_second.TokensPerSecondCallback(
    resume_from_checkpoint=None,
)

Restore the cumulative token counters when resuming from a checkpoint.

Throughput itself is computed in the trainer’s log() from deltas of the cumulative trainable counter, so it is unaffected by gradient_accumulation_steps and logging_steps.

Methods

Name Description
on_train_begin Restore total_tokens state when resuming from checkpoint.
on_train_begin
utils.callbacks.tokens_per_second.TokensPerSecondCallback.on_train_begin(
    args,
    state,
    control,
    **kwargs,
)

Restore total_tokens state when resuming from checkpoint.