Nodes/Extra Models for ComfyUI/Force/Set VAE Device
ComfyUI Node

Force/Set VAE Device

Force/Set VAE Device

By city96·Created 3 years ago·Updated 2 years ago· 538
Force/Set VAE Device
  • vae
  • VAE
devicecpu

This is the VAE-side twin of "Force/Set CLIP Device" from the same pack, and it does exactly what the name says: takes a VAE object and pins it to a specific device instead of leaving placement to ComfyUI's default memory management. Same mechanism, same one job, different object type.

You'll reach for this one less often than its CLIP sibling, and that's not a knock - VAEs are just smaller. A text encoder can be gigabytes; a VAE is usually a few hundred megabytes, so it's rarely the thing pushing you over your VRAM budget on its own. Where it does earn its keep is decode-heavy situations: big batches, tiled decoding at high resolutions, or any workflow where you're already right at the edge and the VAE decode step is the straw that breaks it. Forcing the VAE onto cpu for that decode step trades some speed for headroom, which is a fine trade when the alternative is an out-of-memory crash losing you the whole render.

It's also handy with some of this pack's own oddball VAE architectures - the Consistency Decoder and the old CompVis autoencoders loaded through ExtraVAELoader, for instance - since those aren't as heavily optimized as the stock SD VAE and can be pickier about memory.

Inputs. Two, both required: vae - any VAE object, from any loader, this pack's ExtraVAELoader included - and device, a dropdown defaulting to cpu. As with the CLIP version, what else appears in the dropdown depends on what your system exposes to PyTorch; a second GPU gives you a cuda:1-style target as an alternative to cpu.

Output. VAE - same object, relocated. Wire it straight into your VAEDecode (or VAEEncode) node like you would any other VAE.

Where it fits. Right after your VAE loader, before decode. It's a transparent pass-through so there's no cost to leaving it in a workflow even on runs where you don't need it.

Installing it. Via ComfyUI Manager, search "Extra Models for ComfyUI" - or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/city96/ComfyUI_ExtraModels

Then pip install -r requirements.txt inside your venv/conda env and restart. The requirements file covers the pack as a whole (transformers, bitsandbytes, etc. for the model loaders), not this node specifically, but you need it installed for the pack to load at all. Portable/embedded Windows builds have their own pip invocation documented in the README - worth reading before you improvise one.

Troubleshooting notes. If you force the VAE to cpu and decode gets painfully slow, that's expected - VAE decode on CPU is meaningfully slower than on a GPU, it's just not usually the bottleneck people worry about first. If you're chasing VRAM room and the VAE isn't actually the problem (it almost never is, on its own), look at your text encoder and diffusion model placement first - this node solves a narrow problem, and using it where it's not needed just adds CPU-transfer overhead for nothing. And same caveat as the CLIP version: moving something off VRAM doesn't make its memory footprint vanish, it just changes which budget it's drawing from.

CategoryExtraModels/other

Inputs (2)

NameTypeDefaultDescription
deviceCOMBOcpu1 options: cpu
vaeVAE

Outputs (1)

NameTypeDescription
VAEVAE