Serializer
Freeze your merge in plain text (and share it without the gigabytes)
- recipe
- recipe_txt
If you've ever rebuilt a merge by hand a month later and given up halfway because you'd forgotten which alpha went where, this node is for you. The Serializer (class Mecha Serializer) takes any MECHA_RECIPE and turns it into a plain-text recipe in the sd-mecha format - the .mecha format that the pack's backing library, sd-mecha, uses. It's the bookkeeping half of the pack, and it's one of the reasons comfy-mecha is worth running at all.
Model merging in ComfyUI normally means you build a graph, run it, and hope you remember what you did. Mecha's whole pitch is that a merge is a recipe - a small, inspectable, serializable description of how checkpoints and LoRAs combine - and this node is how you get that description out of your graph and onto disk.
How it works
Everything in this pack flows through the MECHA_RECIPE type: a recipe is a symbolic description of a merge (models, LoRAs, operations), not the merged tensors themselves. sd_mecha.serialize() walks that description and emits it as text. The output is meant to be read and stored:
weighted_sum(base = "sd_xl_base_1.0.safetensors", delta = add_difference(base = "a.safetensors", b = "b.safetensors"), alpha = 0.5)
- recipe (
MECHA_RECIPE, required) - whatever merge recipe you want to capture. Wire it off the end of your merge chain, or off an intermediate branch. - recipe_txt (
STRING, output) - the serialized recipe. You can save this to a text file, paste it into a workflow, diff two versions, or drop it into the pack's Deserializer node, which is the exact inverse operation - feed it a mecha string and get aMECHA_RECIPEback.
So the workflow for "keep this merge forever" is: build the graph once → serialize → save the text → rebuild it later from the text alone, no rethinking required. You can even share the recipe in a forum post without uploading any model. The models still have to exist on the other machine, but the intent travels in a few hundred bytes.
Install
This ships in the Mecha Merge Node Pack (ljleb/comfy-mecha), so it's a one-time install for the whole pack:
- ComfyUI Manager → Install Custom Nodes → search "mecha" → install Mecha Merge Node Pack, or
- manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ljleb/comfy-mecha.git
pip install -r comfy-mecha/requirements.txt
Then restart ComfyUI. The only real dependency is sd-mecha==1.1.7 (the pack pins it); there are no model downloads, no weights to fetch. If you already have the pack, you already have Serializer - it's in the mecha category.
Common issues
- Recipe strings look cryptic at first. That's the sd-mecha format; it's designed to round-trip, not to read like a sentence. If a recipe won't deserialize, it's usually a version mismatch - regenerate it on the machine that wrote it.
- Recipes aren't checkpoints. Serializing gives you the instructions; you still need a Mecha Merger node in the graph to actually produce a UNet/text encoder you can sample from.
- Text outputs disappear unless you look.
STRINGoutput nodes only show their value if you display the node's output in the UI or save it to a file - connectrecipe_txtsomewhere you'll actually see it.
Honestly? For one-off merges you can skip this node. For anything you'll rerun, tweak, or share, serializing the recipe is the difference between "I merged it once" and "I can rebuild this exact model on command."
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| recipe | MECHA_RECIPE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| recipe_txt | STRING | — |