XB-BOX - 🖼️ Wan VAE 解码
The tile-stride dial that saves your run
- vae
- samples
- image
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) andtile_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
cleanupdropdown that runs after decoding:不做任何清理(nothing),单次缓存清理(single cache clear),双次缓存清理(double clear, the default - callssoft_empty_cacheplusgc.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.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| vae | WANVAE | — | |
| samples | LATENT | — | |
| enable_vae_tiling | BOOLEAN | true | — |
| tile_x | INT | 25664–1024 | — |
| tile_y | INT | 25664–1024 | — |
| tile_stride_x | INT | 19232–1024 | — |
| tile_stride_y | INT | 19232–1024 | — |
| cleanup | COMBO | 单次缓存清理 | 4 options: 不做任何清理, 单次缓存清理, 双次缓存清理, 卸载显存模型 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |