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

SDXL-KOHYA_KOHYA_LORA Components Params

Per-component weights for kohya checkpoints with kohya-trained LoRAs

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

    If you've ever merged a kohya-trained SDXL model and kohya-trained LoRAs into the same recipe, you know the pain: the checkpoint keys and the LoRA keys don't use the same names, and getting them to line up is fiddly. The SDXL-KOHYA_KOHYA_LORA Components Params node from comfy-mecha exists precisely so that pairing has its own param node.

    Read the name as two clauses: SDXL-KOHYA describes the checkpoint key layout (kohya-style SDXL), and KOHYA_LORA describes the LoRA key layout (kohya-trained, i.e. the lora_unet_* / lora_te1_* family of keys). It's the config that covers both halves of a "merge a kohya SDXL with kohya LoRAs" workflow.

    Inputs are the four components:

    • diffuser - UNet weight
    • clip_l, clip_g - the two text encoders
    • vae - autoencoder weight

    It returns a single MECHA_RECIPE of per-component weights. You wire that into a merge method's (delta|param|weight) input - for a LoRA merge that usually means Add Difference, which is how mecha applies LoRA-like deltas onto a base model. Setting a component to 0 leaves it untouched.

    How it works

    Same machinery as every Components Params node: each float becomes a literal per-key weight restricted to one component of the config, and the results are combined into one recipe. The config covers both the checkpoint keys and the LoRA keys, so a merge that touches both - e.g. "apply this kohya LoRA delta to this kohya checkpoint" - stays in one consistent key universe instead of two.

    Install

    Pack-level install, same for everything in comfy-mecha: ComfyUI Manager → search "mecha" → Mecha 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 ComfyUI. Only real dependency is sd-mecha; no model downloads.

    Gotchas

    Match the LoRA clause to how your LoRA was actually trained. If the LoRA came from kohya's sd-scripts, KOHYA_LORA fits. If it was trained with LyCORIS (LoCon/LoHa style networks), the key naming is different and you want the SDXL-KOHYA_LYCORIS_LORA variant. Guessing wrong here is the usual reason a LoRA merge "does nothing" or throws key errors - the pack naming is telling you exactly which dialect it was built for.

    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