nemos.callbacks.Callback#
- class nemos.callbacks.Callback[source]#
Bases:
objectBase class for training callbacks.
All hooks are no-ops by default. Subclass and override the hooks you need.
- __init__()#
Methods
__init__()on_batch_begin(ctx)Run before each batch update.
on_batch_end(ctx)Run after each batch update.
on_pass_begin(ctx)Run at the start of a pass.
on_pass_end(ctx)Run at the end of each pass.
on_train_begin(ctx)Run once at the start of training.
on_train_end(ctx)Run once at the end of training.
- on_batch_begin(ctx)[source]#
Run before each batch update.
- Return type:
- Parameters:
ctx (TrainingContext)
- on_batch_end(ctx)[source]#
Run after each batch update.
- Return type:
- Parameters:
ctx (TrainingContext)
- on_pass_begin(ctx)[source]#
Run at the start of a pass.
This hook is called after the training loop advances
ctx.pass_idxand before the first batch of that pass is processed. It marks the start of pass-level work from the callback perspective.Solver-specific pass preparation may still occur after this hook and before the first batch update. Callbacks should therefore treat this hook as notification that a new pass is starting, not as a guarantee that all solver-internal pass setup has already completed.
- Return type:
- Parameters:
ctx (TrainingContext)
- on_pass_end(ctx)[source]#
Run at the end of each pass.
- Return type:
- Parameters:
ctx (TrainingContext)
- on_train_begin(ctx)[source]#
Run once at the start of training.
- Return type:
- Parameters:
ctx (TrainingContext)
- on_train_end(ctx)[source]#
Run once at the end of training.
- Return type:
- Parameters:
ctx (TrainingContext)