Nodes/ComfyUI Level Pixel/Override VAE Device [LP]
ComfyUI Node

Override VAE Device [LP]

Dodging the out-of-memory crash right at decode

By LevelPixel·Created 2 years ago·Updated 5 months ago· 31
Override VAE Device [LP]
  • vae
  • VAE
devicecpu

Same pattern as this pack's OverrideCLIPDevice-LP, applied to the VAE instead: force it onto CPU or leave it on ComfyUI's automatic placement (auto). The reason this particular override tends to matter more than you'd expect: VAE decode is a memory spike moment, not a steady-state cost, and it has a nasty habit of being the thing that OOMs right at the finish line.

Why the decode step is where things go wrong

Sampling can fit comfortably in VRAM for the entire run, and then decoding the final latent back into pixels needs a transient burst of extra memory - especially with a large batch or a high resolution - that pushes you just over the edge. It's a uniquely frustrating failure because you've already paid for the whole generation and it dies on the very last step. Forcing VAE decode onto CPU sidesteps that spike entirely: you trade a much slower decode for not crashing at all. This is the same idea behind community workarounds like ComfyUI's --no-half-vae flag, just exposed here as a per-node toggle instead of a global launch argument - so you can leave VAE on GPU everywhere else in your setup and only force it to CPU for the specific graphs that actually need it.

Worth knowing the actual cost of that trade: GPU memory bandwidth runs something like 2880 Gbit/s, versus roughly 205 Gbit/s for typical system RAM - over an order of magnitude slower. Moving VAE work to CPU isn't a free lunch, it's a deliberate "slow but working" over "fast but crashes" choice.

The inputs and outputs that matter

  • device - auto or cpu, default cpu. Dropping this node with defaults immediately forces VAE decode onto CPU.
  • vae - the VAE model, wired in from your checkpoint or a dedicated VAE loader.
  • Output - VAE, the same model with its device pinned, wired onward to your VAE Decode node.

How to install it

ComfyUI Manager: search "ComfyUI Level Pixel" or ComfyUI-LevelPixel, install, restart - auto-updates via Manager's "Update ALL." Manual:

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

Restart ComfyUI. No models, no extra dependencies - a thin wrapper over ComfyUI's own device placement.

Common issues & troubleshooting

Decode now takes noticeably longer, and it looks like ComfyUI has frozen. It hasn't - it's genuinely doing the pixel math on CPU, which given the bandwidth gap above is a lot slower than the same work on GPU. Let it finish; check your task manager / system monitor for CPU activity if you want reassurance it's actually working rather than stuck.

Still running out of memory even with VAE forced to CPU. CPU decode still needs system RAM, not VRAM - a large batch or a very high-resolution image can genuinely eat several gigabytes of ordinary RAM during decode too. If you're OOMing on a memory-constrained machine generally, forcing VAE to CPU only fixes the VRAM side of the equation, not RAM pressure.

You only need this occasionally, not for every generation. That's exactly the case this node is built for - leave your VAE on auto normally, and only route it through this override (set to cpu) for the specific high-res or large-batch graphs where decode is the thing that tips you over your VRAM budget.

CategoryLevelPixel/Unloaders

Inputs (2)

NameTypeDefaultDescription
deviceCOMBOcpu2 options: auto, cpu
vaeVAE

Outputs (1)

NameTypeDescription
VAEVAE