ema
¶
EMA (Exponential Moving Average) callback.
Owns the full EMA lifecycle: creation, per-step updates, weight
swapping for validation, and checkpoint state. All EMA config
lives under callbacks.ema in the YAML file.
Classes¶
fastvideo.train.callbacks.ema.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
Functions¶
fastvideo.train.callbacks.ema.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.