llmcompressor.transformers.finetune.callbacks
DisableHalfPrecisionCallback
Bases: TrainerCallback
TrainerCallback for disabling FP16 training before QAT training begins
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trainer | LLM Compressor trainer that will call back into this object | required | |
args | args to be passed to base TrainerCallback | () | |
kwargs | key word arguments to be passed to base TrainerCallback | {} |
Source code in src/llmcompressor/transformers/finetune/callbacks.py
on_epoch_begin(args, state, control, **kwargs)
Event called at the beginning of an epoch.
Source code in src/llmcompressor/transformers/finetune/callbacks.py
qat_active()
Returns:
Type | Description |
---|---|
bool | True if a quantization modifier is active in the current session |
TrainingLoopCallbacks
Bases: TrainerCallback
TrainerCallback for triggering CompressionSession callbacks in the training loop. Used to update the model reference(for running with FSDP) and trigger the post- optim callbacks in each modifier.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trainer | LLM Compressor trainer that will call back into this object | required | |
args | args to be passed to base TrainerCallback | () | |
kwargs | key word arguments to be passed to base TrainerCallback | {} |
Source code in src/llmcompressor/transformers/finetune/callbacks.py
on_step_end(args, state, control, **kwargs)
Event called at the end of a training step. If using gradient accumulation, one training step might take several inputs.
Triggers optimizer post_step and batch_end in the active CompressionSession
Source code in src/llmcompressor/transformers/finetune/callbacks.py
on_substep_end(args, state, control, **kwargs)
Event called at the end of an substep during gradient accumulation.
Triggers optimizer post_step and batch_end in the active CompressionSession
Source code in src/llmcompressor/transformers/finetune/callbacks.py
on_train_begin(args, state, control, **kwargs)
Event called at the beginning of training. Update the session reference to the model, as it will have changed to a wrapper if FSDP is enabled