ec433fbe2d2bf2aa16ccc4fabd6b659255a3cb8a
sd-mecha for Comfyui
comfy-mecha is a complete model merging node pack for ComfyUI with a focus on low memory footprint.
- compose complex recipes without needing to save dozens of intermediate merges to disk
- merge loras to models
- support for block weights
- and a bunch of other stuff. For more info, see the nodes listing below. See also the readme of the underlying library sd-mecha
Workflows
Basic weighted sum
Clipped add difference
Ties merging
Recipe workflows can get much, much more complex than this.
If you are familiar with writing python code, you might be interested in using the sd-mecha library directly for experiments as an alternative to ComfyUI: https://github.com/ljleb/sd-mecha
Install
Install with ComfyUI-Manager
Assuming you have ComfyUI-Manager installed:
- Open a browser tab on ComfyUI
- Click on the "Manager" button
- Click on "Install Custom Nodes"
- Search for "mecha"
- Install "Mecha Merge Node Pack"
Install manually
You can also install the node pack manually:
cd custom_nodes
git clone https://github.com/ljleb/comfy-mecha.git
pip install -r comfy-mecha/requirements.txt
Nodes listing
Merge nodes
Nodes used for merging. They all have Recipe in their name except for Mecha Merger.
- nodes ending in
... Mecha Recipereturn a merge recipe Mecha Mergertakes aMECHA_RECIPEas input, and returns a unet and a text encoderMecha Model Recipeloads a model as a recipe to be used as input to other recipe nodes. model architecture detection is not yet supported, so please make sure the rightarchparameter is selected!Mecha Recipe Listtakes an arbitrary number of recipes and returns aMECHA_RECIPE_LIST. It is intended to be used as input to recipe nodes that accept an arbitrary number of recipes as input, i.e. theboundsinput ofClip Mecha RecipeMecha Custom Code Recipeis a very experimental node for custom code and might be removed eventually. It is hard to create recipes and debug with it. I'd advise against using it and instead registering a custom merge method using the sd-mecha library directly
Hyper nodes
Nodes used to specify hyper(parameters) to merge methods. For example, Weighted Sum Mecha Recipe has a hyper input alpha with a default value of 0.5.
Blocks Mecha Hypercan specify a different hyper for each block of the models to be merged (AKA "merge block weighted" or "MBW")Float Mecha Hyperspecifies the same float for all blocks of the models to be merged
Languages
Python
89.1%
JavaScript
10.9%


