Skip to content

callbacks

Modules

fastvideo.tests.train.callbacks.test_callback

CPU-only unit tests for :mod:fastvideo.train.callbacks.callback.

Covers the Callback base class no-op contract and the CallbackDict instantiation / dispatch / state-dict logic.

The concrete callback subclasses (GradNormClipCallback, EMACallback, ValidationCallback) have their own test files.

Classes

fastvideo.tests.train.callbacks.test_ema

CPU-only unit tests for :mod:fastvideo.train.callbacks.ema.

Exercises the EMA lifecycle (lazy init, start_iter gating, decay math, ema_context swap, state-dict round-trip) on a tiny CPU nn.Linear. EMA_FSDP works without dist.init_process_group because dist.is_initialized() returns False and _to_local_tensor falls through to raw tensors for non-DTensor inputs.

Classes

fastvideo.tests.train.callbacks.test_grad_clip

CPU-only unit tests for :mod:fastvideo.train.callbacks.grad_clip.

Exercises GradNormClipCallback.on_before_optimizer_step against synthetic nn.Module targets with manually populated gradients.

Classes

fastvideo.tests.train.callbacks.test_validation

CPU-only unit tests for :mod:fastvideo.train.callbacks.validation.

Covers the parts of ValidationCallback that don't need a real pipeline or distributed init:

  • constructor type coercions and defaults,
  • on_validation_begin gating logic (every_steps + modulo),
  • _find_ema_callback lookup via _callback_dict,
  • state_dict / load_state_dict rng round-trip.

The heavy _run_validation path needs a real diffusion pipeline plus distributed init and is exercised by Phase ⅔ tests.

Classes