Nodes/comfy-mecha-utils/Diffusion Model
ComfyUI Node

Diffusion Model

Hand a bare diffusion model to a comfy-mecha merge without touching the checkpoints folder

By jupo-ai·Created 2 years ago·Updated 4 months ago· 8
Diffusion Model
    • recipe
    model_name
    model_configauto
    merge_spacedefault

    If you've ever tried to merge models inside ComfyUI with the stock nodes, you know the pain: merging two checkpoints wants a surprising amount of RAM, and the whole thing feels bolted on. comfy-mecha fixes the memory half of that - it merges key-by-key by reading the safetensors header, so it only ever holds one tensor at a time instead of loading both parents. This node, from jupo's comfy-mecha-utils pack, is a small convenience on top of that: a loader that reads a .safetensors out of your models/diffusion_models folder and hands it to comfy-mecha as a MECHA_RECIPE.

    Why does that matter if comfy-mecha already has its own Model node? Because that one reads the checkpoints folder, and ModelAny scans several folders. If you keep your merge ingredients as bare diffusion models - the UNet-weight part of a checkpoint, which is exactly how a lot of people organize Anima, SDXL, and Flux fine-tunes - you want a loader that's scoped to diffusion_models and nothing else. That's the entire job here.

    How it works

    Under the hood it's one call: sd_mecha.model(model_path, config=..., merge_space=...). The node just builds a ComfyMechaRecipe wrapper and pushes it out. It's a recipe producer, not a merge runner - the actual merging and the conversion back into a usable ComfyUI model happens in comfy-mecha's Merger node. Wire this node's output anywhere comfy-mecha expects a model input (like the parents of a WeightedSum), then run the whole thing through Merger.

    The inputs that matter

    • model_name - dropdown of every .safetensors in models/diffusion_models. There's nothing else to it.
    • model_config - defaults to auto, which means "let sd-mecha figure out the base from the file." If sd-mecha can't identify the architecture, you can pick an explicit base config here (like sdxl-sgm or sd1-ldm) instead of guessing at the file contents.
    • merge_space - leave it on default. It maps to sd-mecha's weight merge space, which is what you want for ordinary additive mixing.

    The single output is recipe of type MECHA_RECIPE, and it's not a model - a common first-timer trap is trying to feed it straight into a sampler. It only makes sense as an ingredient in a comfy-mecha merge graph.

    Installing it

    The pack needs comfy-mecha installed first - it's a separate custom node, and without it your MECHA_RECIPE outputs have nothing to consume them. Then:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jupo-ai/comfy-mecha-utils
    

    then restart ComfyUI. Easier still: ComfyUI Manager → install custom nodes → search "comfy-mecha-utils". It's registered on the Comfy Registry, so Manager pulls in the one pip dependency (sd-mecha) automatically. There are no model files to download and no API key - the pack's real dependency is just the sd-mecha library.

    Where people get burned

    The classic failure is installing this pack, finding the nodes, and wondering why nothing merges - because comfy-mecha itself isn't installed. Check for the Merger node in your node list; if it's missing, that's the problem. And if model_config on auto fails to resolve a config for an unusual file, set it explicitly rather than blaming the node - "auto" here means "trust sd-mecha's detection," and detection isn't infallible on every new architecture that ships.

    Categoryjupo/MechaUtils

    Inputs (3)

    NameTypeDefaultDescription
    model_nameCOMBO0 options:
    model_configoptCOMBOauto11 options: auto, singleton-mecha, sdxl-kohya, sdxl-kohya_but_diffusers, sd1-kohya, sdxl-sgm, +5
    merge_spaceoptCOMBOdefault4 options: default, weight, delta, param

    Outputs (1)

    NameTypeDescription
    recipeMECHA_RECIPE