Nodes/CMK Flow/CMK Smart Upscaler -Pipe-
ComfyUI Node

CMK Smart Upscaler -Pipe-

The upscaler that lets go of your models before it grabs another one

By CMKFlow·Created 3 months ago·Updated 2 days ago· 6
CMK Smart Upscaler -Pipe-
  • IMAGE
  • LOG
  • VISUAL
  • IMAGE
  • LOG
  • VISUAL
  • diagnostic
◄enabletrue►
◄limit_4x_mp1.5►
◄limit_2x_mp8.0►
◄model_4x▾►
◄model_2x▾►
◄save_enabled—►

CMK Smart Upscaler -Pipe- is the same megapixel-based 4x/2x logic as the standalone CMK Smart Upscaler, wrapped in CMK's pipe transport - and with one addition that matters more than it sounds: before it loads the upscale network, it unloads every diffusion model ComfyUI is holding and clears the cache.

Why that's the interesting bit

The source comment is blunt about it: this module is the terminal image stage, and keeping SDXL and refiner weights resident while Spandrel constructs a RealESRGAN network can exceed unified memory and trigger VM-reclaim assertions on macOS. So you get an explicit memory barrier - unload_all_models(), a soft cache empty, gc.collect() - printed to the console so you can see it happened. On a 12GB card running SDXL with a refiner, that's the difference between the upscale finishing and the process getting killed.

The selection logic is unchanged: input up to limit_4x_mp (1.5 MP) goes through the 4x model, up to limit_2x_mp (8 MP) through the 2x model, anything larger passes through untouched with a warning. Tiled inference at 768 pixels with 32 overlap, halving the tile on OOM down to 128.

Inputs and outputs

  • IMAGE and LOG - both required. LOG is copied and extended, never replaced, so the upscale step shows up in the chain's audit trail rather than overwriting it.
  • enable (default true), limit_4x_mp, limit_2x_mp, model_4x, model_2x.
  • VISUAL (optional) - the accumulated provider chain; the node registers a before/after pair with the label Upscale & Save and sequence 90, which is what the Visualizer reads.
  • save_enabled (optional, forced input) - an extra switch that comes off a wire, typically from the finish module's own save toggle.

Outputs: IMAGE, LOG, VISUAL, diagnostic.

The enable plus save_enabled combination is worth understanding, because it's the pack being economical on your behalf: enable false gives you a passthrough and logs STATUS: DISABLED / MODE: PASSTHROUGH, while save_enabled false means no upscale runs at all - the reason line reads "Save is disabled", because there's no point spending a minute on a 4x pass for an image nobody is going to write to disk. That's a design tell for the whole pack, and it's stated as a principle in its architecture notes: a disabled module's expensive internals must remain entirely unrequested.

Installing

Manager: search CMK Flow → install the CMKFlow entry → restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/CMKFlow/cmk_nodes.git cmk_nodes
python3 cmk_nodes/scripts/install_cmk_requirements.py
python3 cmk_nodes/scripts/check_cmk_resources.py --models-root "/path/to/shared/models"

Your upscale checkpoints live in ComfyUI/models/upscale_models - the resource script lists the RealESRGAN family among what it can verify and download. CMK needs Vue Nodes / Nodes 2.0 enabled, and Comfy 0.38.2 is the verified frontend pairing.

Traps

The two model dropdowns don't check each other. Point both at 4x checkpoints and your "2x" threshold will produce a 4x result, which is the fastest way to turn a careful memory budget into an OOM at the end of a long chain - and the end of the chain is exactly where people stop babysitting the render.

Second: because this node unloads diffusion models on the way through, don't put it midway in a graph that goes back to generating afterwards. It's built as a terminal stage, and if you stick a refiner after it you'll be paying a full model reload. The pack's own layout reflects that - upscale and save sit at the end, and the pack considers a non-standard order permitted but not cheap. Keep detailing and refinement upstream, where they belong anyway: fix at native resolution, then upscale.

CategoryCMK/Flow/PostProcess

Inputs (9)

NameTypeDefaultDescription
IMAGE*—
LOG*—
enableBOOLEANtrue—
limit_4x_mpFLOAT1.50.5–100—
limit_2x_mpFLOAT8.00.5–100—
model_4xCOMBO0 options:
model_2xCOMBO0 options:
VISUALoptCMK_VISUAL_PIPE—
save_enabledoptBOOLEAN—

Outputs (4)

NameTypeDescription
IMAGEIMAGE—
LOGCMK_LOG_PIPE—
VISUALCMK_VISUAL_PIPE—
diagnosticCMK_DIAGNOSTIC—