ComfyUI Node

Pass Mask_v2

A mask reroute that can also give VRAM a breather

By r-vage·Created about a year ago·Updated 5 months ago· 23
Pass Mask_v2
  • mask
  • MASK
Purge_VRAMfalse

Pass Mask_v2 is the plain Pass Mask with one extra widget bolted on: Purge_VRAM. Same core behavior - a MASK goes in and the identical MASK comes out - but flip that toggle and the node runs a memory flush on its way through. It's a reroute and a VRAM pressure-relief valve in one, aimed at the workflow where a mask-handling stage keeps crashing with out-of-memory.

The mechanism is right in the source. With Purge_VRAM true, the node calls gc.collect(), then torch.cuda.empty_cache() and ipc_collect() on CUDA, then comfy.model_management.unload_all_models() and soft_empty_cache() - and only after that returns your mask untouched. In plain English: empty PyTorch's cached memory and kick every loaded model out of VRAM before the pipeline continues. It's a sledgehammer, not a scalpel; it doesn't care which model you were hoping to keep resident. The mask itself is never modified, so downstream behavior is unchanged apart from the reload cost of whatever model runs next.

When does a mask passer even need to do that? Consider a typical upscale-and-detail flow: mask generation happens while a segmentation model is loaded, then the mask feeds a face/region detailer that loads a completely different checkpoint. If your VRAM is tight, the handoff is where it dies. A Pass Mask_v2 with Purge_VRAM on sits at that boundary, evicts the mask-stage model, and gives the next stage a clean slate. You pay the reload time every time it fires, so use it at stage boundaries - and only when you actually see OOMs. On a single-model workflow the toggle is dead weight.

Apart from the flush button, it does the standard passer job: a stable junction so one mask can fan out to several consumers, with the source node easily swapped or bypassed without ripping out downstream wires. That's the core value of the whole RvTools passer family, which the README describes as a fix for nodes that lost track of bypassed inputs and as the second node you need to form a managed group.

Inputs

  • mask (MASK, required) - the mask to pass through.
  • Purge_VRAM (BOOLEAN, default false) - when enabled, flushes the CUDA cache and unloads all models before passing.

Output is one MASK, unchanged.

Install

Ships in ComfyUI-RvTools_v2. ComfyUI Manager → search "ComfyUI-RvTools_v2" → install, restart. Or:

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

Find it under RvTools II / Passer. No model downloads; dependencies are the standard torch/numpy/Pillow stack plus opencv-python, pilgram, pynvml, piexif.

One warning

The whole pack is marked deprecated in its README in favor of ComfyUI_Eclipse, which absorbs most RvTools nodes - so expect no updates here. And be honest with yourself about the toggle: Purge_VRAM is all-or-nothing and reloads models, so it's a tool for a specific OOM-at-the-handoff problem, not a thing to leave on forever.

Category🫦 RvTools II/ Passer

Inputs (2)

NameTypeDefaultDescription
maskMASK
Purge_VRAMBOOLEANfalse

Outputs (1)

NameTypeDescription
MASKMASK