🔄 Component Replacer
Bake a different VAE into a checkpoint — and read the number that tells you if it worked
- Replacement Result
🔄 Component Replacer is the other half of the box cutter. Where the extractor cuts a component out into its own file, this pushes one back in and writes a whole new checkpoint - so the change travels with the file instead of living in a dropdown you forget to set.
Why bake it in instead of loading a VAE?
Because a baked-in component is a property of the file, not of the workflow. Load a VAE in the graph and it applies to one pipeline on one machine; bake it into the checkpoint and the model behaves the same when you hand it to someone, batch it through an API, or drop it into an old workflow with no VAE loader at all.
The reason shifted, though. In the SD1.5 era you did this to fix grey, washed-out images by putting vae-ft-mse-840000-ema-pruned inside a checkpoint that lacked one. These days the VAE is usually baked already, and the live complaint is the opposite - over-smoothing from a decoder someone tuned for something other than texture. That 2026 fix - swapping a Qwen-Image VAE for the Wan 2.1 one - is not what this node does: cross-architecture swaps never survive the shape check, and they shouldn't. Same-family, same-shape only.
How the replacement actually works
It loads two models fully into CPU RAM - target from models/checkpoints, donor from models/model_toolkit_extracted - then works out which target keys belong to the component you selected, using the same template-then-prefix logic as the extractor. Every donor key then lands in one of three buckets:
- In the target's component set, same shape → overwritten.
- In the component set, different shape → skipped, counted as a shape mismatch.
- Anything else - a UNET key when you asked for VAE, or a key the target doesn't have → ignored, counted separately.
Only then does it save, into ComfyUI/output/ - not the extractor's folder, which is the biggest trip-up in this pack.
The four fields and the one output
model_name is the target, from models/checkpoints. component is UNET, VAE or CLIP, and decides which keys are even eligible to be written - nothing outside it is touched, even when key names collide across components. replacement_name is the donor, from models/model_toolkit_extracted; the README notes you can drop a full checkpoint in that folder and only its matching component is taken, so you can pull a VAE from a second checkpoint without a round trip through the extractor. output_name defaults to modified_model, with .safetensors appended if you leave the extension off.
Out comes one STRING, Replacement Result: Replaced 249/249 VAE keys, saved to: …, with suffixes for shape mismatches and ignored non-component keys.
Read that number. Partial replacement is by design. Feed it a donor whose layout doesn't fit and you'll get something like Replaced 40/248 VAE keys, skipped 208 shape mismatches - the file saves, the node reports success, and the model is now a chimera that renders noise or something subtly wrong. A clean run is Replaced N/N.
Install
Manager, search ComfyUI Model Toolkit. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/StarAsh042/ComfyUI_model_toolkit.git
pip install -r ComfyUI_model_toolkit/requirements.txt
Two dependencies: safetensors>=0.3.0 and pyyaml>=5.4.0. Torch is intentionally excluded so the pip step can't reinstall or downgrade your host torch. Restart - the pack registers its nodes and its extra model folder at import time, so the node doesn't exist until then.
Where people get burned
You can't find the output file. It's in ComfyUI/output/ - not models/checkpoints, and not next to the extracted component. Move it into your checkpoints folder and refresh before Load Checkpoint lists it - that asymmetry with the extractor confuses everybody.
Memory. Two full models resident plus a third written. SDXL fp16 is roughly 13 GB; Flux fp16 will politely ask your swap file for help. Empty queue only.
modified_model gets overwritten silently. The default name is a footgun: every second experiment with defaults replaces the last, and you won't notice until two files turn out to be one.
You can't add a component that isn't there. If the target has no VAE keys, the node stops with ❌ Target model has no VAE component to replace. Load the checkpoint's MODEL and put a separate Load VAE in the graph instead.
The donor dropdown is stale after an extraction. That list is built when ComfyUI asks the node for its inputs, so refresh the browser page. An empty list gets you ❌ Replacement component not found: … (run the 📤 Component Extractor first).
Nothing is validated against reality. It checks key names and shapes, not whether the swapped component is good. Run 🔍 Model Inspector on the result - the parameter reconciliation tab shows whether you produced the file you meant to, which is why this pack ships all three nodes together.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | 0 options: | |
| component | COMBO | UNET | 3 options: UNET, VAE, CLIP |
| replacement_name | COMBO | 0 options: | |
| output_name | STRING | modified_model | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Replacement Result | STRING | — |