Nodes/XB_ToolBox/XB-BOX - 🎨 Wan VAE 加载
ComfyUI Node

XB-BOX - 🎨 Wan VAE 加载

The Wan VAE loader with the free VRAM trim

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - 🎨 Wan VAE 加载
  • compile_args
  • vae
model_name
precisionbf16
use_cpu_cachefalse

Every Wan workflow needs the video VAE - the piece that turns pixel frames into latents and back. This is XB-BOX's loader for it ("🎨 Wan VAE 加载"), and it does two things the stock VAE loader can't: it auto-detects which Wan VAE architecture you've got, and it applies the "pruned VAE" trick that cuts decode VRAM dramatically with almost no visible quality loss.

How it works

It loads a safetensors file from your vae folder and figures out the architecture by looking at the tensor shapes - WanVideoVAE38 if the second conv has 48 output channels, the base WanVideoVAE otherwise. Then the clever bit: if the decoder's first conv has 96 channels, it builds the VAE with a pruning rate of 0.75, which drops three quarters of the decoder channels. This is the known "pruned Wan VAE" technique - the decoder is the fattest part of decode, and most of those channels barely matter, so you get a big VRAM savings at the cost of some fine detail. That's why so many Wan workflows on 8–16GB cards ship with a tiny VAE file and still look fine.

It also exposes use_cpu_cache (off by default): with it on, the VAE weights live in system RAM and stream to the GPU only during encode/decode. If your decode is the thing OOMing, that's the switch to try before dropping resolution.

The inputs

  • model_name - pick your Wan VAE file (wan2.1_vae_fp16 or an fp8/pruned variant from ComfyUI/models/vae).
  • precision - bf16 default; fp16 and fp32 available. bf16 is the right call on most cards.
  • compile_args (optional) - a WANCOMPILEARGS from XB_WanCompileSettings, if you're compiling the VAE for speed.
  • use_cpu_cache (optional) - see above.

Output: a single vae socket (WANVAE) that feeds the decode nodes and the conditioning builders.

Install

Standard XB_BOX install - ComfyUI Manager search XB_ToolBox or clone into custom_nodes, then restart. The loader builds the VAE through ComfyUI-WanVideoWrapper, so that has to be present, and you need the actual Wan VAE weights in the vae folder. Note the output type is WANVAE, not the plain VAE - don't feed this into a stock VAEDecode and expect it to work; use the wrapper/XB decode nodes that expect it.

Common issues

A WANVAE type mismatch on a downstream node usually means you grabbed the wrong loader. If decoded video has visible banding or blur on fine detail, that's the pruning showing itself - swap in the full (unpruned) VAE file. And if nothing shows up in model_name, your vae folder is empty or the pack can't see it.

CategoryXB_ToolBox/Wan

Inputs (4)

NameTypeDefaultDescription
model_nameCOMBO0 options:
precisionCOMBObf163 options: bf16, fp16, fp32
compile_argsoptWANCOMPILEARGS
use_cpu_cacheoptBOOLEANfalse

Outputs (1)

NameTypeDescription
vaeWANVAE