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

SDXL-KOHYA Components Params

Per-component merge weights for kohya-style SDXL checkpoints

By ljleb·Created 3 years ago·Updated about a month ago· 101
SDXL-KOHYA Components Params
    • recipe
    vae0.00
    clip_l0.00
    clip_g0.00
    diffuser0.00

    A huge share of SDXL fine-tunes and merges on CivitAI are trained with kohya-ss scripts, and that matters for merging: the keys inside those checkpoints use kohya's naming, which is not the same dialect as Stability's original SDXL checkpoints. This node, the SDXL-KOHYA Components Params node from comfy-mecha, is the per-component weight slider for checkpoints in that kohya layout.

    Like every Components Params node, it doesn't merge by itself. It produces a MECHA_RECIPE of per-component weights that you plug into the (delta|param|weight) input of a merge recipe node, so the merge can move the UNet and the text encoders at different strengths. Its inputs:

    • diffuser - the UNet weight.
    • clip_l and clip_g - the two SDXL text encoders.
    • vae - the autoencoder; set to 0 to keep model A's.

    Note there's no scheduler here. The kohya SDXL config doesn't carry the noise-schedule tensors the way the SGM layout does, so it doesn't get a slider. That's a feature, not a bug - it's one less thing to think about.

    Why you'd reach for it

    When both of your source checkpoints are kohya-layout SDXL (a very common situation), this is the right param node, and the pair to grab is this one plus a kohya-layout model config. Common pattern: diffuser at 1.0, clip_l/clip_g at 0.5, vae at 0 - merge the drawing part fully, only nudge the style-holding text encoders, and keep one VAE.

    How it works

    Each float becomes a literal per-key weight restricted to its component of the sdxl-kohya config (pick_component under the hood), and the four are OR'd into one MECHA_RECIPE. Feed that into Weighted Sum's alpha or Add Difference's weight and mecha applies it per key. Finish at Mecha Merger to get real MODEL/CLIP/VAE outputs.

    Install

    Standard for the pack: ComfyUI Manager → search "mecha" → 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
    

    Restart ComfyUI. The only dependency is the sd-mecha library; nothing to download model-wise.

    Gotchas

    The dialect thing is real and it's the whole reason this node exists. If you feed kohya-layout checkpoints into the plain SDXL-SGM param node, the key matching can silently fail or match nothing useful - which is why comfy-mecha ships a separate node per key dialect. The rule of thumb: match the param node to the key layout of the checkpoints you're merging, not to your personal preference. If you're also merging LoRAs, the SDXL-KOHYA_KOHYA_LORA and SDXL-KOHYA_LYCORIS_LORA variants of this node describe LoRA key layouts on top of the same checkpoint layout.

    Categorymecha

    Inputs (4)

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

    Outputs (1)

    NameTypeDescription
    recipeMECHA_RECIPE