Nodes/XB_ToolBox/XB-BOX - VAE解码(原版优化)
ComfyUI Node

XB-BOX - VAE解码(原版优化)

Decode huge latents without OOM — this is ComfyUI's tiled decoder with a cleanup switch

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - VAE解码(原版优化)
  • samples
  • vae
  • IMAGE
tile_size512
overlap64
cleanup不做任何清理

XB_VAEDecodeTiledImage lives under the "XB-BOX - VAE解码(原版优化)" family in the node menu, and the name is doing a lot of work you should understand before you trust it. "原版优化" translates to "original, optimized" - which here means not a from-scratch decoder. Open the source and it's a thin wrapper around ComfyUI's own VAEDecodeTiled that injects one extra widget: a four-level VRAM cleanup dropdown. That's the whole contribution. Don't expect different math, different quality, or a speed boost. Expect a big image that fits in VRAM where the plain decoder would have fallen over, plus a way to clear the decks right before it runs.

When you'd actually reach for it

You've sampled a 2048x2048 or bigger latent, or a high-res tiled workflow handed you a large batch, and the vanilla VAEDecode chokes with CUDA out of memory. Tiled decode splits the image into spatial tiles, decodes each with overlap, and stitches them back - so peak memory stays near one tile's worth instead of the whole image. This node is exactly that, with a Chinese-labeled cleanup dropdown bolted on the front. It also exists because the pack's author targets AMD/ROCm users, where a fragmented VRAM cache is a much more common killer than on NVIDIA; the wrapper forces a clean state before decoding.

The inputs that matter

Only a few, and they're all familiar if you've touched tiled VAE nodes before:

  • samples (LATENT) and vae (VAE) - your latent and the VAE, wired exactly like the core node.
  • tile_size - spatial tile size in pixels, default 512, range 256–4096. Bigger tiles mean fewer seams and more VRAM; start at 512 and only raise it if you're not near the ceiling.
  • overlap - tile overlap in pixels, default 64. Overlap hides tile-boundary seams; if you see grid lines, raise it before you change anything else.
  • cleanup - the pack's signature dropdown. Four choices, all Chinese: "不做任何清理" (no cleanup, the default), "单次缓存清理" (soft+hard cache empty), "卸载显存模型" (unload VRAM models back to RAM), and "卸载全量模型" (nuclear: unloads everything, runs gc.collect() and IPC collect).

The output is a single IMAGE, ready for a preview or Save node.

The trap

The default cleanup is no cleanup, so out of the box this node behaves identically to stock VAEDecodeTiled. That's the point - it's a drop-in that only gets aggressive when you ask. Set it to "卸载全量模型" and every queue tick will unload and reload your whole model stack, which can turn a quick decode into a painfully slow one. Use "卸载显存模型" before a heavy video step, leave it alone for ordinary images, and reserve "卸载全量模型" for the moment a big encode/decode is about to OOM anyway.

Installing it

It ships in the XB_ToolBox pack, not standalone. Easiest path is ComfyUI Manager: search "XB_ToolBox" and install. Or clone it manually:

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

Restart ComfyUI. The core VAE wrapper nodes need no extra pip packages - they call ComfyUI's own nodes.VAEDecodeTiled - though the pack as a whole pulls in opencv-python and friends for its video nodes. If a workflow errors on missing cv2, let Manager install the requirements.

One more compatibility note worth knowing: the wrapper probes the decode function's signature and silently drops parameters your ComfyUI version doesn't support, so old bundled installs (Chinese "整合包" like 秋叶) won't crash on a missing temporal_size argument. If you see a console line about a dropped parameter, that's the safety net working, not a bug.

CategoryXB_ToolBox/原版优化

Inputs (5)

NameTypeDefaultDescription
samplesLATENT
vaeVAE
tile_sizeINT512256–4096空间分块大小(像素)
overlapINT640–256空间块重叠(像素)
cleanupCOMBO不做任何清理4 options: 不做任何清理, 单次缓存清理, 卸载显存模型, 卸载全量模型

Outputs (1)

NameTypeDescription
IMAGEIMAGE