You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of the Wan video family (tracking: #741). Stack layer 3.
Scope (wan/03-vae)
New crates/mold-inference/src/wan/model/vae.rs: Wan's causal 3D VAE with feat-cache temporal streaming — the property that makes 121-frame 720p decode fit 24 GB (O(1) memory in T). Implementation strategy: CausalConv3d as Conv2d-slices summed per output frame (proven by Ltx2VideoCausalConv3d; candle has no cudnn conv3d and doesn't need one).
2.1 VAE (all 1.3B/14B/A14B models; z=16, stride 4×8×8, dim 96, dim_mult [1,2,4,4], 2 res blocks, temporal downsample [F,T,T]):
CausalConv3d with left-only temporal pad; when cache_x supplied, prepend cached tail and reduce pad
Feat-cache protocol: CACHE_T=2 trailing frames per conv, flat cache indexed by conv-visit order (feat_idx counter); encode chunks 1/4/4/4 pixel frames; decode 1 latent frame per iteration; 'Rep' sentinel path in upsample3d for the first chunk; downsample3d caches the raw last frame. Wrong cache order/chunking ⇒ temporal seams every 4 frames.
RMS_norm (per-channel, gamma [dim,1,1]), single-head per-frame 2D attention mid-block, encoder/decoder per ComfyUI key layout (decoder.upsamples.{0..14} flat Sequential — see report §1.3 for exact keys)
Per-channel latent mean/std vectors in code (16 values each; encode (µ−mean)/std, decode input z·std+mean, output clamp [−1,1]); encode returns distribution mean (no sampling)
Part of the Wan video family (tracking: #741). Stack layer 3.
Scope (
wan/03-vae)New
crates/mold-inference/src/wan/model/vae.rs: Wan's causal 3D VAE with feat-cache temporal streaming — the property that makes 121-frame 720p decode fit 24 GB (O(1) memory in T). Implementation strategy:CausalConv3das Conv2d-slices summed per output frame (proven byLtx2VideoCausalConv3d; candle has no cudnn conv3d and doesn't need one).2.1 VAE (all 1.3B/14B/A14B models; z=16, stride 4×8×8, dim 96, dim_mult [1,2,4,4], 2 res blocks, temporal downsample [F,T,T]):
CausalConv3dwith left-only temporal pad; whencache_xsupplied, prepend cached tail and reduce padCACHE_T=2trailing frames per conv, flat cache indexed by conv-visit order (feat_idxcounter); encode chunks 1/4/4/4 pixel frames; decode 1 latent frame per iteration;'Rep'sentinel path in upsample3d for the first chunk; downsample3d caches the raw last frame. Wrong cache order/chunking ⇒ temporal seams every 4 frames.[dim,1,1]), single-head per-frame 2D attention mid-block, encoder/decoder per ComfyUI key layout (decoder.upsamples.{0..14}flat Sequential — see report §1.3 for exact keys)(µ−mean)/std, decode inputz·std+mean, output clamp [−1,1]); encode returns distribution mean (no sampling)vae_tiling.rsarithmetic (ComfyUI: 256 px tiles, ¼ overlap) for OOM headroom2.2 VAE (TI2V-5B only; z=48, stride 4×16×16):
AvgDown3Davg-pool shortcuts /DupUp3Drepeat shortcuts, which drop the first factor_t−1 output frames whenfirst_chunk; nesteddownsamples.{s}.downsamples.{j}key layout; 48-value mean/std tables copied verbatimAcceptance
AutoencoderKLWanon a fixed image → encode → decode round tripKey facts:
tmp/wan-research/report-official-wan.md§3,report-comfyui.md§1.3/§4,report-diffusers.md§5.