Nodes/ComfyUI-RvTools_v2/String Switch v2
ComfyUI Node

String Switch v2

The same switch, with a VRAM nuke button

By r-vage·Created about a year ago·Updated 5 months ago· 23
String Switch v2
    • string
    Input1
    Purge_VRAMfalse
    input1
    input2

    This is the plain String Switch from the same pack with one extra checkbox bolted on: Purge_VRAM. That's the entire difference between v1 and v2, so if you read the String Switch article, the switch mechanics are identical - Input widget picks between input1 and input2, bypassing forwards input1, and the string output is just a STRING. The new thing is what happens before the switch runs when you tick Purge_VRAM.

    Ticking it makes the node unload everything from VRAM before it passes the string: it forces a garbage collect, empties the CUDA cache, then calls ComfyUI's unload_all_models and soft_empty_cache. The idea is that when you switch branches - say, from one prompt track that pulls a heavy checkpoint to another that pulls a different one - the previous model isn't still squatting in VRAM when the new branch starts loading. Clean slate, no OOM.

    Be honest about what this costs, though. It's a sledgehammer. It unloads every model, not just the one you're switching away from, and the next run has to reload everything cold, which is slower. On a pure text switch it's usually pointless - switching a string doesn't load or free anything. It earns its keep when the string switch sits in front of a branch that loads a big model and you're bouncing between branches. If you just want to swap prompts, leave it off.

    The toggle's presence here tells you something about how the author uses switches: as the seam between whole workflow groups that get bypassed and re-enabled. When a group comes back, its models should load into empty VRAM. That's the v2 feature in one sentence.

    Installing it

    Part of the RvTools_v2 pack - one install, all nodes. ComfyUI Manager → search ComfyUI-RvTools_v2, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/r-vage/ComfyUI-RvTools_v2
    

    Restart after. No models, no keys, no special dependencies beyond what ComfyUI already ships.

    One caveat to know going in: the pack is no longer maintained and the README points to ComfyUI_Eclipse as the successor. v2 itself was the rename-and-fix release (v1's repo vanished at one point, which broke a lot of workflows and confused ComfyUI Manager), so the [RvTools] suffix on the node name is deliberate.

    Common issues

    • Slower runs with Purge_VRAM on. Every queue reloads all models from disk. Expected, but it surprises people who tick the box "to be safe" and never untick it.
    • Bypass vs. mute, again. Bypass forwards input1; mute passes nothing. The bypass behavior is the feature - don't mute a switch and wonder why the branch died.
    • Purge is all-or-nothing. If you expected it to unload only the previous branch's model, no. That's not what it does.
    Category🫦 RvTools II/ Switches

    Inputs (4)

    NameTypeDefaultDescription
    InputINT11–2
    Purge_VRAMBOOLEANfalse
    input1optSTRING
    input2optSTRING

    Outputs (1)

    NameTypeDescription
    stringSTRING