ComfyUI Node

SDXL-SGM Blocks

26 sliders for the UNet

By ljleb·Created 3 years ago·Updated about a month ago· 101
SDXL-SGM Blocks
    • recipe
    BASE0.00
    IN000.00
    IN010.00
    IN020.00
    IN030.00
    IN040.00
    IN050.00
    IN060.00
    IN070.00
    IN080.00
    M000.00
    OUT000.00
    OUT010.00
    OUT020.00
    OUT030.00
    OUT040.00
    OUT050.00
    OUT060.00
    OUT070.00
    OUT080.00
    VAE0.00

    If you came from the old SuperMerger world, you know block-weighted merging: instead of one alpha for the whole model, you give every section of the UNet its own weight, so layer 0 of the model comes from A while layer 20 comes from B. The SDXL-SGM Blocks node (class SDXL-SGM Mecha Blocks Parameters) brings that exact idea to comfy-mecha.

    It's a param node: it produces a MECHA_RECIPE of per-block weights that you feed into a merge method's (delta|param|weight) input. With block weights connected, a method like Weighted Sum applies a different alpha per UNet block instead of one global value.

    The inputs

    It's a grid of floats that maps onto the SDXL UNet:

    • BASE - the input/output stem
    • IN00IN08 - the nine input blocks (downsampling side)
    • M00 - the single middle block
    • OUT00OUT08 - the nine output blocks (upsampling side)
    • VAE - the autoencoder (set to 0 to keep one VAE)

    That's the standard SDXL block layout - 26 block values plus base and VAE - the same shape of control SuperMerger users expect. A classic use: drop the values in the IN blocks toward A and the OUT blocks toward B, so the merge takes the early structure from one model and the later detail from the other.

    How it works

    Under the hood the node builds a literal weight recipe in the sdxl-supermerger_blocks layout and converts it to the sdxl-sgm config - the pack reuses the block layout that SuperMerger made familiar, then maps it onto SDXL's real keys. The result is a MECHA_RECIPE; plug it into a merge recipe node, then finish at Mecha Merger for actual MODEL/CLIP/VAE outputs.

    Install

    Same as the whole pack: 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 dependency is sd-mecha; no model downloads.

    Gotchas

    Block weights are the deep end of merging - easy to over-tune, and a block map that "worked" for someone else's checkpoints usually won't transfer cleanly. Start with all blocks equal (which is just a normal weighted sum) and move a few sliders at a time, or you'll have no idea which block did what. Also: this node is for the SGM key layout; if your checkpoints are kohya-layout, the Blocks Mecha Hyper node in the same pack (with its own model-config dropdown) is the more flexible sibling.

    Categorymecha

    Inputs (21)

    NameTypeDefaultDescription
    BASEFLOAT0.00-18446744073709550000–18446744073709550000
    IN00FLOAT0.00-18446744073709550000–18446744073709550000
    IN01FLOAT0.00-18446744073709550000–18446744073709550000
    IN02FLOAT0.00-18446744073709550000–18446744073709550000
    IN03FLOAT0.00-18446744073709550000–18446744073709550000
    IN04FLOAT0.00-18446744073709550000–18446744073709550000
    IN05FLOAT0.00-18446744073709550000–18446744073709550000
    IN06FLOAT0.00-18446744073709550000–18446744073709550000
    IN07FLOAT0.00-18446744073709550000–18446744073709550000
    IN08FLOAT0.00-18446744073709550000–18446744073709550000
    M00FLOAT0.00-18446744073709550000–18446744073709550000
    OUT00FLOAT0.00-18446744073709550000–18446744073709550000
    OUT01FLOAT0.00-18446744073709550000–18446744073709550000
    OUT02FLOAT0.00-18446744073709550000–18446744073709550000
    OUT03FLOAT0.00-18446744073709550000–18446744073709550000
    OUT04FLOAT0.00-18446744073709550000–18446744073709550000
    OUT05FLOAT0.00-18446744073709550000–18446744073709550000
    OUT06FLOAT0.00-18446744073709550000–18446744073709550000
    OUT07FLOAT0.00-18446744073709550000–18446744073709550000
    OUT08FLOAT0.00-18446744073709550000–18446744073709550000
    VAEFLOAT0.00-18446744073709550000–18446744073709550000

    Outputs (1)

    NameTypeDescription
    recipeMECHA_RECIPE