ComfyUI Node

Merger

The terminal node — turn a recipe graph into a usable MODEL, CLIP, and VAE

By ljleb·Created 2 years ago·Updated 29 days ago· 101
Merger
  • recipe
  • MODEL
  • CLIP
  • VAE
  • recipe_txt
fallback_modelnone
default_merge_devicecpu
default_merge_dtypefp32
output_devicecpu
output_dtypefp16
total_buffer_size0.5G
threads-1
omit_vaetrue
temporary_mergetrue
strict_weight_spacetrue
check_finite_outputtrue
omit_non_finite_inputstrue
memoize_intermediatestrue

Every recipe node in the Mecha Merge Node Pack - Weighted Sum, Add Difference, Clamp, Dropout, all of them - just describes a merge. Nothing has actually been computed. Mecha Merger is the node that finally does the work: you feed it a MECHA_RECIPE and it executes the whole graph, key by key, and hands you a ready-to-use MODEL, CLIP, and VAE (plus the recipe text). It's the only terminal node in the merge section, and every workflow in this pack ends here.

The "key by key" part is the pack's whole reason to exist. The underlying sd-mecha library reads the safetensors header to learn every key and where each tensor lives in the file, then merges one key at a time (or a few, with threads) inside a bounded buffer - so merging two SDXL checkpoints doesn't require holding two full checkpoints in RAM. The author's pitch, in the pack's own release thread, was literally "model merging node pack that does not take all your RAM." This node is where that promise lands.

Inputs that matter

  • recipe - the MECHA_RECIPE to execute. The only required input.
  • fallback_model - an optional checkpoint to supply any missing keys. Default none.
  • default_merge_device (default: your main torch device) and default_merge_dtype (default fp32) - where and at what precision the merge math runs. Merge in fp32 and output in fp16 is the sane default pairing.
  • output_device (default cpu) and output_dtype (default fp16) - the precision/location of the returned weights.
  • total_buffer_size (default "0.5G") - how much memory the key-by-key merge is allowed to use. It accepts multi-term strings like "1G 500K". More buffer = faster (more keys in flight), less = smaller footprint. This is your real memory dial.
  • threads (default -1, meaning "library default") - parallel key processing, capped at 16.
  • omit_vae (default true) - drop the VAE from the merge. Leave on unless you specifically want a merged VAE; it keeps the merge smaller and avoids pointless work.
  • temporary_merge (default true) - cache this merge's output for the run so re-runs skip it (via a hash of the recipe).
  • strict_weight_space, check_finite_output, omit_non_finite_inputs, memoize_intermediates - validation and safety toggles; the defaults are the right ones until they aren't.

Outputs: MODEL, CLIP, VAE - wire those straight into your sampler and save nodes - plus recipe_txt, a STRING of the serialized recipe for bookkeeping.

The workflow

Model/Lora Mecha Recipe ──▶ ...merge nodes... ──▶ Mecha Merger ──▶ MODEL/CLIP/VAE ──▶ KSampler

Load checkpoints and LoRAs as recipes, compose them, merge once, generate. No intermediate files on disk - the whole point of the pack.

Install & gotchas

ComfyUI Manager → search mechaMecha Merge Node Pack, or:

cd ComfyUI/custom_nodes
git clone https://github.com/ljleb/comfy-mecha.git
pip install -r comfy-mecha/requirements.txt

Restart; only dependency is sd-mecha==1.1.7 - no models are downloaded by the pack.

The failure modes worth knowing: if ComfyUI can't recognize the merged result, the node raises "Comfy did not recognize this diffusion model" - usually a recipe that mixed incompatible configs; a Mecha Converter step fixes it. A "missing VAE" after merge is expected when omit_vae is on and your workflow needs one - either turn it off or supply a VAE from a loader. And temporary_merge + merge_checkpointing can both be on, but they're separate mechanisms: checkpointing stores a branch on CPU in fp16, while temporary_merge caches the final result for the run. If a merge appears to "not re-run" when you changed inputs, check whether you left a cache node or checkpointing pinning stale data.

Categorymecha

Inputs (14)

NameTypeDefaultDescription
recipeMECHA_RECIPE
fallback_modeloptCOMBOnone1 options: none
default_merge_deviceoptCOMBOcpu2 options: none, cpu
default_merge_dtypeoptCOMBOfp327 options: none, fp8_e4m3fn, fp8_e5m2, bf16, fp16, fp32, +1
output_deviceoptCOMBOcpu2 options: none, cpu
output_dtypeoptCOMBOfp167 options: none, fp8_e4m3fn, fp8_e5m2, bf16, fp16, fp32, +1
total_buffer_sizeoptSTRING0.5G
threadsoptINT-1-1–16
omit_vaeoptBOOLEANtrue
temporary_mergeoptBOOLEANtrue
strict_weight_spaceoptBOOLEANtrue
check_finite_outputoptBOOLEANtrue
omit_non_finite_inputsoptBOOLEANtrue
memoize_intermediatesoptBOOLEANtrue

Outputs (4)

NameTypeDescription
MODELMODEL
CLIPCLIP
VAEVAE
recipe_txtSTRING