Latent Switch v2
The two-way latent tap with a VRAM escape hatch
- input1
- input2
- latent
Latent Switch v2 is a two-position switch for LATENT data - pick input 1 or input 2 and it hands that latent through. Latents being what they are (compressed, un-decodeable noise tensors until the VAE has its way with them), you'll mostly use this to choose between generation paths rather than between finished things: one branch that upscales the latent before sampling, another that doesn't, or an img2img latent from an encode versus a fresh empty latent.
The "v2" in the name matters. The pack's v1 latent switch is a pure selector; the v2 adds one widget on top, and it's a doozy for people on small GPUs:
- Purge_VRAM (BOOLEAN, default false) - when you flip this on, the node runs a full cleanup the moment it executes: garbage collection, CUDA cache empty, IPC collect, then
unload_all_models()and a soft cache empty from ComfyUI's model management. It's an on-demand "free my VRAM" panic button embedded in a switch.
That might sound odd until you've hit the classic multi-branch workflow problem: you've loaded two samplers' worth of models, switched branches, and the other model is still parked in VRAM. Flipping Purge_VRAM on at the switch point unloads everything so the next branch loads clean instead of OOM-ing. It's blunt - it unloads all models, not just the ones you're done with - but it's the right tool when a workflow just won't fit.
Inputs and outputs
- Input (INT, 1–2, default 1) - the selector.
- input1 / input2 (LATENT, optional) - the two latent candidates. Both are
forceInput, so you connect latent sources rather than typing anything. - Output latent (LATENT) - the selected one.
- Purge_VRAM - as above, the v2 addition.
Standard pack behavior carries over: bypass the node and it sends input 1 through, so treat slot 1 as the safe default.
Installing it
Part of ComfyUI-RvTools_v2:
cd ComfyUI/custom_nodes
git clone https://github.com/r-vage/ComfyUI-RvTools_v2
Restart ComfyUI or use ComfyUI Manager → search "RvTools" → Install → Restart. No model downloads. Dependencies are the usual torch/numpy/Pillow plus opencv-python, pilgram, pynvml, piexif.
Gotchas
README says the pack is no longer maintained, superseded by ComfyUI_Eclipse - most of these nodes moved there. v2 still runs.
Two things to remember about Purge_VRAM. It runs every time the node executes while the toggle is on, and it nukes everything - if you've got another branch mid-cache that you wanted to keep, this will flush it. That's why it defaults to off. Use it deliberately, ideally toggled only when you're about to hit the OOM wall, not as a permanent fixture of the workflow.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| Input | INT | 11–2 | — |
| Purge_VRAM | BOOLEAN | false | — |
| input1opt | LATENT | — | |
| input2opt | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |