wan22 ¶
Wan2.2-TI2V-5B dense MLX runtime — Track D.
The Wan2.2 TI2V-5B (FullAttn) differs from the ported Wan2.1-T2V only in:
- Scale (24 heads x 128, hidden 3072, ffn 14336) — pure config, block math identical, so the dense loader
mlx_dit_from_diffusers_safetensorsloads the weights unchanged and we re-wrap the blocks here. - Per-token timestep conditioning (
expand_timesteps=True): the timestep is[batch, seq_len](a level per patch token — how TI2V keeps the conditioning image frame at t=0 while the video frames are noised).timestep_projbecomes[batch, seq_len, 6, dim]and the block/output modulation is per-token ([B, L, dim]), a direct broadcast — this module implements exactly that.
I2V rides on the same forward: encode the image, replace the first latent frame, and set that frame's timestep to 0 (handled by the caller / sampler). See docs/design/ti2v_5b_port_guide.md.
Classes¶
fastvideo.mlx_runtime.wan22.MLXWan22DiT ¶
MLXWan22DiT(weights: dict[str, array], blocks: list[MLXWan22TransformerBlock], config: dict, *, compile: bool = False)
Wan2.2-TI2V-5B dense DiT with per-token timestep conditioning.
Source code in fastvideo/mlx_runtime/wan22.py
fastvideo.mlx_runtime.wan22.MLXWan22TransformerBlock ¶
MLXWan22TransformerBlock(weights: dict[str, array], *, dim: int, ffn_dim: int, num_heads: int, eps: float = 1e-06)
Dense Wan block with per-token ([B, L, dim]) timestep modulation.
Source code in fastvideo/mlx_runtime/wan22.py
Functions:¶
fastvideo.mlx_runtime.wan22.mlx_wan22_dit_from_diffusers_safetensors ¶
mlx_wan22_dit_from_diffusers_safetensors(checkpoint_path: str | Path, config_path: str | Path, *, dtype: str = 'fp16', num_blocks: int | None = None, quantization=None, compile: bool = False) -> MLXWan22DiT
Load Wan2.2-TI2V-5B (FullAttn) into MLXWan22DiT via the dense loader.
Source code in fastvideo/mlx_runtime/wan22.py
fastvideo.mlx_runtime.wan22.mlx_wan22_dit_from_mlx_checkpoint ¶
mlx_wan22_dit_from_mlx_checkpoint(checkpoint_dir: str | Path, *, compile: bool = False) -> MLXWan22DiT
Rewrap a persisted MLX DiT checkpoint with Wan2.2 conditioning.
The generic checkpoint loader intentionally rebuilds MLXWanDiT because it is also used by the Wan2.1 runtime. Wan2.2 TI2V has the same weight layout but needs per-token timestep modulation, so callers must rewrap the loaded weights and blocks as :class:MLXWan22DiT before sampling.