Fixes all P1/P2 items from the review of 7c7704da:
- E2E test's data_path pointed at a nonexistent combined_parquet_dataset/
subdir; preprocess_kandinsky5_overfit.py writes directly to its output
root.
- Stage 2 loaded the raw DCP checkpoint-N/ directly, which isn't a
diffusers model dir. Added dcp_to_diffusers --verify (strict-reload
the export immediately) and wired the conversion into the E2E test,
launcher scripts, and README between stage 1 and stage 2.
- Kandinsky5DmdDenoisingStage called the transformer without
set_forward_context, so LocalAttention's missing-context guard caught
the AssertionError and silently fell back to plain SDPA -- Stage 2
validation never actually exercised ATTN_QAT_TRAIN. Wrapped the call
to match the parent stage's contract and added a scoped backend
assertion (ATTN_QAT_TRAIN/ATTN_QAT_INFER only, since other backends
can legitimately fall back to auto-selection).
- Exported DMD checkpoints kept the base T2V model_index.json, so
VideoGenerator.from_pretrained resolved them to Kandinsky5T2VPipeline
instead of the DMD sampler. Added Kandinsky5DMDConfig and documented
the required override_pipeline_cls_name + pipeline_config combo.
- The FSDP-training dtype-detection special case (scan params, default
to bf16) applied unconditionally, so an explicit fp32 pipeline was
silently cast to bf16 for plain inference. Extracted
_resolve_target_dtype and gated the scan on isinstance(transformer,
FSDPModule).
- Preprocessing tokenized captions with a 512-token cap that doesn't
account for the 129-token system template runtime strips off; now
reads text_encoder_max_lengths from pipeline_config to match runtime.
Also replaced unconditional item["cap"][0] indexing (silently takes
the first character of a string caption) with a get_caption() helper
that accepts/validates both the documented string schema and the
list-of-variants schema some producers use.
- test_kandinsky5_qat_attention_engages.py set FASTVIDEO_ATTENTION_BACKEND
and cleared the attention backend selector cache without teardown,
leaking ATTN_QAT_TRAIN into later tests in the same pytest process.
Now uses monkeypatch + try/finally.
Added regression tests: test_kandinsky5_target_dtype.py,
test_kandinsky5_dmd_pipeline_resolution.py,
test_kandinsky5_overfit_caption.py.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds the training-side counterpart to the existing Kandinsky-5 T2V/I2V
inference pipeline (#1471): a full quantization-aware distillation (QAD)
recipe for Kandinsky-5.0 Lite T2V at 512x768/121 frames on the new
fastvideo/train/ stack.
- Data preprocessing: preprocess_kandinsky5_overfit.py encodes raw
video + captions (Kandinsky5's shared HunyuanVideo VAE + dual
Qwen/Reason1 + CLIP text encoders) into the t2v parquet schema.
- Stage 1 (Attn-QAT finetune): fastvideo.train.models.kandinsky5.Kandinsky5Model
wires Kandinsky5 into the modular trainer; FASTVIDEO_ATTENTION_BACKEND=
ATTN_QAT_TRAIN routes dense/local attention through a fake-quantized
straight-through-estimator kernel during finetuning so the DiT learns
to absorb quantization error. No weight quantization during training.
- Stage 2 (QAT-aware DMD2 distillation): Kandinsky5DmdDenoisingStage +
Kandinsky5DMDPipeline distill the stage-1 checkpoint from many-step
teacher sampling down to a 4-step student, with teacher/critic masked
back to full-precision dense attention regardless of the student's
QAT env var (component_loader.py's _loading_teacher_critic_model gate).
See examples/train/configs/fine_tuning/kandinsky5/README.md for the full
data -> stage-1 -> stage-2 -> inference (NVFP4/FP8) walkthrough.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>