Nodes/XB_ToolBox/XB-BOX - 🖼️ Wan VAE 解码
ComfyUI Node

XB-BOX - 🖼️ Wan VAE 解码

The tile-stride dial that saves your run

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - 🖼️ Wan VAE 解码
  • vae
  • samples
  • image
enable_vae_tilingtrue
tile_x256
tile_y256
tile_stride_x192
tile_stride_y192
cleanup单次缓存清理

The frustrating thing about Wan on a consumer GPU isn't the generation - it's that the VAE decode at the end can blow up your VRAM after the sampler already did the hard work. XB_WanDecode (display name "XB-BOX - 🖼️ Wan VAE 解码") is the pack's take on that final step: it decodes your latent back to pixels with tiled decoding on by default, so a 24GB card doesn't have to hold the whole decoded video in memory at once.

This is the tail end of the classic Wan graph. The sampler spits out a LATENT, this node turns it into an IMAGE, and you wire that image to a video preview/save node. It needs a Wan VAE from the pack's XB_WanVAELoader (the WANVAE type, not a generic VAE socket - they're deliberately kept separate so you don't accidentally pair it with an SD VAE).

How it works

It wraps ComfyUI's own WanVideoDecode and adds two things the stock node doesn't push at you:

  • Tiled VAE decoding, controlled by enable_vae_tiling (on by default), tile_x / tile_y (both default 256) and tile_stride_x / tile_stride_y (both 192). The node decodes the latent in spatial tiles with an overlap between them - stride smaller than tile size means overlapping tiles, which hides seams. If you're on a tight card, leave it on and maybe drop the tiles to 192. On a 24GB card you can flip it off and decode whole-frame for slightly cleaner output.
  • A cleanup dropdown that runs after decoding: 不做任何清理 (nothing), 单次缓存清理 (single cache clear), 双次缓存清理 (double clear, the default - calls soft_empty_cache plus gc.collect()), or 卸载显存模型 (unload all models off VRAM). These exist because Wan leaves a lot of fragmented PyTorch cache behind, and the next generation in a chain starts cleaner after a nuke.

There's also an AMD-specific safety net baked in: on a ROCm build it calls torch.cuda.synchronize() after decode to catch async HIP errors, and if the optimized path throws, it logs a warning, clears cache, and falls back to the official node before retrying. That "switched to official node" message in your console isn't a crash - it's the failover working.

What to set

Honestly: almost nothing. Feed it vae and samples, leave tiling on and cleanup on its default. The one dial worth touching is tile_stride_x/y - if you see tiling seams in your frames, lower the stride (more overlap, more compute) rather than raising the tile size.

Install & context

Same story as every node in this pack: ComfyUI Manager → search XB_ToolBox, or:

cd ComfyUI/custom_nodes
git clone https://github.com/wjluoxiao/XB_ToolBox.git

restart, done. The pack declares opencv-python and easyocr as its only pip dependencies despite the README's "no deps" line, and ships no model files - you supply the Wan VAE (models/vae).

One honest caveat: this node is a convenience wrapper, not a different decoder. If your VRAM is genuinely too small, tiling helps at the margin but doesn't change the fundamental cost of decoding a long clip - that's what the pack's chunked samplers and relay pipelines are actually for.

CategoryXB_ToolBox/Wan

Inputs (8)

NameTypeDefaultDescription
vaeWANVAE
samplesLATENT
enable_vae_tilingBOOLEANtrue
tile_xINT25664–1024
tile_yINT25664–1024
tile_stride_xINT19232–1024
tile_stride_yINT19232–1024
cleanupCOMBO单次缓存清理4 options: 不做任何清理, 单次缓存清理, 双次缓存清理, 卸载显存模型

Outputs (1)

NameTypeDescription
imageIMAGE