Nodes/MagoNodes/WAN Video Tiled Patch (kijai)
ComfyUI Node

WAN Video Tiled Patch (kijai)

WAN tiling for the kijai stack — a WANVIDEOMODEL patch that slots into WanVideoSampler

By MagoStudio·Created 4 months ago·Updated 17 days ago· 6
WAN Video Tiled Patch (kijai)
  • model
  • WANVIDEOMODEL
tiles_h2
tiles_w2
overlap_h25
overlap_w25
scale_schedule
bypass_tilingfalse
debugfalse

If you run WAN through Kijai's ComfyUI-WanVideoWrapper - and a lot of people do, for SageAttention, TeaCache, and the VACE integration - the tiled samplers in the rest of this pack don't touch your workflow. The native WanTiledSamplerPatch hooks model_function_wrapper, which is exactly the hook Kijai's WanVideoSampler never fires: it runs its own sampling loop over its own WANVIDEOMODEL type, and there's no MODELWANVIDEOMODEL bridge. WanVideoTiledPatch is the kijai-specific sibling - a WANVIDEOMODEL → WANVIDEOMODEL patch that brings the same per-step MultiDiffusion spatial tiling (plus the multiscale schedule) to that stack.

Same pitch as the native nodes: WAN models degrade above their training resolution - hue drift, diluted conditioning, out-of-range positional encodings - and tiling keeps every model evaluation at a training-distribution token count while still sampling the full-res latent.

How it works

Instead of wrapping the sampler's hook, this node wraps the transformer's forward directly. Kijai's sampler grabs the transformer once and calls it for every model evaluation; the patch intercepts each call, splits it into overlapping spatial tiles, runs each at fewer tokens, and blends the predictions back with trapezoidal windows - the same algorithm as wan_tiled_sampler's tiled path, adapted to the wrapper's forward contract.

The reason this is correct rather than just plausible: WAN's RoPE self-corrects. grid_sizes is computed inside forward from the sliced latent's shape, and the frequency bank is fixed, so a smaller tile just indexes fewer positions. seq_len is recomputed per tile - fewer tokens is the whole point. vace_data context is sliced spatially and circular-padded to the patch size (the same token-count fix the native node applies), and forward_vace force-aligns vace tokens to the tile's count. Tiling happens in patch units, so every tile boundary is even and unpatchify reconstructs exactly.

The multiscale scale_schedule works as in the native patch: while the scheduled resolution is below 100%, the whole frame runs downscaled in one pass so global motion stays coherent (the I2V fix); at 100% it tiles for detail.

The inputs

  • model - a WANVIDEOMODEL (from Kijai's wrapper). Output is a patched WANVIDEOMODEL that goes straight into WanVideoSampler.
  • tiles_h / tiles_w - spatial tiles, default 2×2; 1 disables an axis.
  • overlap_h / overlap_w - overlap as a percentage of tile size, default 25.
  • scale_schedule - e.g. {0:50, 8:100}. Empty = tiling only.
  • bypass_tiling - with no schedule, this is a plain WanVideoSampler passthrough (a schedule still runs its downscaled steps).
  • debug - prints tile layout, blend sanity check, and per-step scale.

Installing

The pack itself is the usual: ComfyUI Manager → search "ComfyUI-MagoNodes", or

cd ComfyUI/custom_nodes
git clone https://github.com/MagoStudio/ComfyUI-MagoNodes

But this node is useless without the wrapper - you need Kijai's ComfyUI-WanVideoWrapper installed too (Manager search "ComfyUI-WanVideoWrapper"), since WANVIDEOMODEL comes from that pack. Restart after both.

The honest scope

The author is upfront that this is v1, scoped to the VACE-inpainting / wan22fun use case. Three things to know going in:

  • TeaCache must be OFF. Per-tile forwards each carry a distinct token layout, so the shared prediction cache would be invalid; the patch forces pred_id to None. If you've got TeaCache on in the wrapper, tiling won't cooperate.
  • It falls back to a single full-frame forward if it sees other spatially-shaped conditioning (attn_cond, fun_ref, add_cond, controlnet, camera) that isn't in its slicing table. It prints a one-time warning when it does - so watch the console, because that warning means the node is silently doing less than you asked.
  • Don't combine it with the wrapper's temporal context-windows in the same pass.

So: plug patched WANVIDEOMODELWanVideoSampler, keep TeaCache off, check the console once, and you get high-res WAN in the kijai stack without the drift.

CategoryMago Nodes/Sampling

Inputs (8)

NameTypeDefaultDescription
modelWANVIDEOMODEL
tiles_hINT21–8Spatial tiles along height. 1 = no height tiling.
tiles_wINT21–8Spatial tiles along width. 1 = no width tiling.
overlap_hINT250–50Height overlap, % of tile height (0-50).
overlap_wINT250–50Width overlap, % of tile width (0-50).
scale_scheduleoptSTRINGMultiscale (coarse-to-fine) schedule, step → resolution %, e.g. '{0:50, 8:100}'. While the scheduled scale < 100 the whole frame is run at that resolution (tiling off, keeps global motion coherent); at 100 it runs tiled. Empty = always full-res (tiling only).
bypass_tilingoptBOOLEANfalseSkip tiling (unless a scale_schedule is set — a schedule still runs its downscaled steps). With no schedule this is a plain WanVideoSampler passthrough.
debugoptBOOLEANfalsePrint tile layout + blend-weight sanity check + per-step scale.

Outputs (1)

NameTypeDescription
WANVIDEOMODELWANVIDEOMODEL