Nodes/Mecha Merge Node Pack/SDXL-SGM Components Params
ComfyUI Node

SDXL-SGM Components Params

Merge the UNet at full strength and the text encoders at half

By ljleb·Created 2 years ago·Updated 30 days ago· 101
SDXL-SGM Components Params
    • recipe
    clip_l0.00
    clip_g0.00
    vae0.00
    diffuser0.00
    scheduler0.00

    When you merge two SDXL checkpoints, you usually don't want every component moved by the same amount. A flat 50/50 blend often drags in the other model's weird style at full force, especially through the text encoders. This node - the SDXL-SGM Components Params node from comfy-mecha - is the fix: one slider per SDXL component, so you can merge the UNet hard and barely touch the CLIPs.

    It's a "param" node, not a merge node. It doesn't merge anything on its own. What it produces is a MECHA_RECIPE - a set of per-key weights - that you feed into the weight/param/alpha input of a merge recipe node like Weighted Sum or Add Difference. Because mecha lets an alpha be a recipe instead of a scalar, the merge applies a different strength to each component. That's the whole trick.

    What the sliders mean

    The node exposes exactly the five components of the SDXL-SGM key layout:

    • diffuser - the UNet. The part that actually draws.
    • clip_l and clip_g - the two text encoders SDXL uses (CLIP-L and OpenCLIP big-G). They carry most of the "style fingerprint" of a checkpoint.
    • vae - the image autoencoder. Rarely worth merging; most people set it to 0 and keep one VAE.
    • scheduler - the noise schedule (alphas/betas). Usually just leave it.

    A typical setup: diffuser at 1.0, clip_l and clip_g at 0.3–0.6 if you want some of the other model's prompt behavior, vae and scheduler at 0. Set something to 0 and that component isn't touched at all - the merge keeps model A's version.

    How it works

    Under the hood, each float becomes a literal per-key weight restricted to its component, and the five are combined into one recipe (the node builds pick_component recipes and ORs them together). The output is a plain MECHA_RECIPE - wire it into a recipe node's (delta|param|weight) input, then finish at Mecha Merger to get a usable MODEL/CLIP/VAE. If you'd rather bake the whole thing down and reuse it, route the result through the pack's Serializer to get .mecha text.

    Install

    Same as the rest of the pack: in ComfyUI Manager, search "mecha" and install Mecha Merge Node Pack, or manually:

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

    Then restart ComfyUI. The pack's only real Python dependency is the sd-mecha library - no model downloads. Everything shows up under the "mecha" category.

    Gotchas

    The name matters more than it looks: this is the SGM node, i.e. built for SDXL checkpoints in the original Stability key layout. If your checkpoints were trained or converted with kohya-ss scripts, their keys use a different naming, and you want the SDXL-KOHYA variant instead. Plugging the wrong config into a merge is the classic way to get "no keys matched" confusion. And honestly - if you always merge everything at equal strength, this node is overhead. It earns its keep the moment you want the UNet and the text encoders moving at different speeds.

    Categorymecha

    Inputs (5)

    NameTypeDefaultDescription
    clip_lFLOAT0.00-18446744073709550000–18446744073709550000
    clip_gFLOAT0.00-18446744073709550000–18446744073709550000
    vaeFLOAT0.00-18446744073709550000–18446744073709550000
    diffuserFLOAT0.00-18446744073709550000–18446744073709550000
    schedulerFLOAT0.00-18446744073709550000–18446744073709550000

    Outputs (1)

    NameTypeDescription
    recipeMECHA_RECIPE