Register two new video families and wire them through the backend, routes,
and frontend picker: wan2.2-ti2v-5b (single DiT) and wan2.2-t2v-a14b (the
dual-expert MoE). Both share diffusers' WanPipeline + WanTransformer3DModel
+ AutoencoderKLWan, which the VideoFamily dataclass already reserved fields
for (transformer2_class, is_moe, cfg2_kwarg).
Verified against the installed diffusers 0.39.0 before writing code:
- WanPipeline, WanTransformer3DModel, and AutoencoderKLWan are all exported
from top-level diffusers 0.39.0.
- WanPipeline.__call__ (pipeline_wan.py:383) defaults to num_frames=81,
num_inference_steps=50, guidance_scale=5.0. guidance_scale_2 DOES exist
in 0.39 (line 392) and its check_inputs raises if it is passed when the
pipeline's boundary_ratio is None (line 322), so the second guidance is
threaded ONLY for the MoE family and only when inspect.signature accepts
it (the same gate frame_rate already uses).
- The Wan VAE temporal factor is 4 (autoencoder_kl_wan.py scale_factor_temporal),
and the pipeline snaps num_frames to 4k+1 (line 493), so frame_step is 4,
unlike LTX-2's 8k+1. Sizes patchify at spatial 8 * patch 2 = 16, so
resolution_multiple is 16.
- boundary_ratio and transformer_2 come from model_index.json: TI2V-5B ships
boundary_ratio=null and transformer_2=[null,null] (single DiT), while A14B
ships boundary_ratio=0.875 and transformer_2=WanTransformer3DModel (dual
DiT). boundary_ratio lives in the pipeline config, so it needs no per-call
plumbing.
- WanTransformer3DModel declares _repeated_blocks=["WanTransformerBlock"] and
inherits CacheMixin (transformer_wan.py:508/551), so regional compile and
First-Block-Cache both work.
bf16-resident component sizes, measured from each diffusers repo's on-disk
safetensors (all stored bf16), feed the auto memory table:
TI2V-5B: transformer 20.0, UMT5 text encoder 11.4, VAE 2.8 GB.
A14B: two experts 57.2 each (114.3 total), text encoder 11.4, VAE 0.5 GB.
Backend changes make the optimisation layers dual-DiT aware: a small
_SecondDiTView proxy presents transformer_2 as pipe.transformer so the
existing single-DiT helpers (apply_speed_optims, apply_attention_backend,
apply_step_cache, quantize_transformer) cover BOTH experts on an is_moe load
without forking any helper; single-DiT loads are unchanged (views is just
(pipe,)). The two Wan base repos are added to the trusted non-GGUF allowlist.
A transformer_quant option is added to the load path, mirroring the image
backend's dense torchao fast path: on a pipeline-kind load the dense DiT(s)
are quantised in place onto the low-precision tensor cores and the engaged
scheme is surfaced in status. generate() threads guidance_2 through the
family's cfg2_kwarg when the loaded pipeline accepts it.
Routes and Pydantic models gain the optional transformer_quant (load /
status) and guidance_2 (generate) fields. The frontend picker gains the two
Wan models with 50-step / CFG 5.0 defaults; fps is supplied per family by
the backend.
Tests extend the fake runtime with WanPipeline and per-DiT transformer fakes
(single-DiT and dual-DiT), and cover family detection for both repos, 4k+1
frame snapping, default application, dual-DiT speed/cache/attention/quant
coverage on both experts, cfg2 threading gated on the pipeline signature,
trusted-repo validation, and the new route fields. Both the standard and the
diffusers/torchao-blocked CI-sim runs are green.