A tiny helper node for WAN + RadialAttention workflows. It snaps Width / Height / Length to valid values and shows a compact list of valid temporal lengths.
- Models: WAN 14B (stride /16) and WAN 5B (stride /32)
- Inputs:
model_kind,width,height,length - Outputs:
L_snapped,W_out,H_out - UI: compact readout with snapped spatial, snapped length, and valid L in 1..200 (max 4 rows, ellipsis if long)
- Optional: a frontend JS overlay for live, in-node updates while scrubbing (10px font)
- Snaps Width/Height to the nearest multiple of the model’s stride
(14B → /16, 5B → /32). - Computes the temporal congruence so
tokens % 128 == 0, where
tokens = (W/stride) * (H/stride) * ((L+3)/4)with integer(L+3)/4. - Snaps Length
Lto the nearest valid value from that progression. - Displays a compact readout in the node (and live if overlay is installed):
spatial: W_in×H_in → W×H (/ stride)L snapped: …valid L (1..200): N valsfollowed by up to 4 wrapped rows (ellipsis in the middle if long)
stride = 16for WAN 14B,stride = 32for WAN 5B.A = (W/stride) * (H/stride).tokens = A * T'whereT' = (L+3)/4must be an integer.- We want
tokens % 128 == 0→ an arithmetic progression onL:g = gcd(128, A)m = 4 * (128 / g)r = (m - 3) mod m- Valid lengths:
L ≡ r (mod m)
- The node snaps the requested
Lto the nearest valid value.
[Radial Length Helper (WAN)]
├─ L_snapped → [EmptyHunyuanLatentVideo.length]
├─ W_out → [EmptyHunyuanLatentVideo.width]
└─ H_out → [EmptyHunyuanLatentVideo.height]
- Works with ComfyUI Windows Portable (Python embedded ok).
- Independent of torch/CUDA; the node itself has no native deps.
- Overlay uses Comfy’s
app.registerExtensionhook (no extra packages).
- MIT (or your preferred permissive license).
- Thanks to the EA Motion Bias node for the UX pattern (live overlay, compact readout).