ljleb / comfy-mecha

Executable Stable Diffusion merge recipes in comfyui
MIT License
58 stars 3 forks source link

Discord Server

sd-mecha for Comfyui

comfy-mecha is a complete model merging node pack for ComfyUI with a focus on low memory footprint.

Workflows

Basic weighted sum

resources/weighted_sum.png

Clipped add difference

resources/clipped_add_difference.png

Ties merging

resources/ties_merging.png

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:

  1. Open a browser tab on ComfyUI
  2. Click on the "Manager" button
  3. Click on "Install Custom Nodes"
  4. Search for "mecha"
  5. 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.

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.

Extensions

To add custom merge nodes, you can add python scripts that make use of the mecha extension API under the mecha_extensions directory. The node pack will run all scripts placed there before creating the comfy nodes.

Currently, the documentation for the mecha extension API is under construction. For now, to get more information, you can either take a look at the custom merge method example, open a discussion post to ask questions, or join the discord server.