callbacks ¶
Classes¶
fastvideo.train.callbacks.Callback ¶
Base callback with no-op hooks.
Subclasses override whichever hooks they need. The training_config and method attributes are set by CallbackDict after instantiation.
fastvideo.train.callbacks.CallbackDict ¶
Manages a collection of named callbacks.
Instantiates each callback from its _target_ config and dispatches hook calls to all registered callbacks.
Source code in fastvideo/train/callbacks/callback.py
fastvideo.train.callbacks.EMACallback ¶
Bases: Callback
Manage EMA shadow weights for the student transformer.
All configuration lives in the YAML callbacks.ema section:
.. code-block:: yaml
callbacks:
ema:
decay: 0.9999
start_iter: 0
The callback creates an EMA_FSDP instance at train start, updates it after each optimizer step, and exposes an ema_context() context manager for temporarily swapping EMA weights into the live model (used by validation).
Source code in fastvideo/train/callbacks/ema.py
Methods:¶
fastvideo.train.callbacks.EMACallback.ema_context ¶
ema_context(transformer: Module) -> Generator[Module, None, None]
Temporarily swap EMA weights into transformer.
If EMA is not active, yields the transformer unchanged.
Source code in fastvideo/train/callbacks/ema.py
fastvideo.train.callbacks.GradNormClipCallback ¶
Bases: Callback
Clip gradient norms before the optimizer step.
max_grad_norm must be set explicitly in the callback config (callbacks.grad_clip.max_grad_norm).
Source code in fastvideo/train/callbacks/grad_clip.py
fastvideo.train.callbacks.ValidationCallback ¶
ValidationCallback(*, pipeline_target: str, dataset_file: str, every_steps: int = 100, sampling_steps: list[int] | None = None, guidance_scale: float | None = None, num_frames: int | None = None, output_dir: str | None = None, sampling_timesteps: list[int] | None = None, overlay_actions: bool = False, keyboard_value_scale: float = 1.0, offload_training_state: bool = False, unload_pipeline_after_validation: bool = False, attn_qat_infer: bool = False, **pipeline_kwargs: Any)
Bases: Callback
Generic validation callback driven entirely by YAML config.
Works with any pipeline that follows the PipelineCls.from_pretrained(...) + pipeline.forward() contract.