ComfyUI Node

Pick Component

Keep only the VAE, the CLIP, or the UNet — merge pieces on purpose

By ljleb·Created 3 years ago·Updated about a month ago· 101
Pick Component
  • a (delta|param|weight)
  • component (param)
  • recipe
merge_checkpointingfalse

Pick Component (class Pick Component Mecha Recipe) is the mirror image of Omit Component: instead of stripping one component out of a merge, it keeps only that component and drops everything else. Give it a recipe and the name of a part of the model - vae, clip_l, diffuser, whatever your architecture defines - and you get back just those keys.

This is the node that turns a monolithic checkpoint into a parts kit. Model merging in most tools is all-or-nothing: you merge whole files. Mecha's component system lets you treat a checkpoint as separable pieces, and Pick Component is how you extract a single piece to use on its own or to recombine at will.

How it works

Each model config in sd-mecha knows which tensors belong to which component. This node validates the component name against that config - a bad name produces an error listing the valid options - then passes through only the keys in that component, skipping every other key in the recipe.

The inputs that matter:

  • a (delta|param|weight) (MECHA_RECIPE, required) - the recipe to filter.
  • component (param) - the component to keep. On SD1-LDM checkpoints: clip_l, vae, diffuser, ema, scheduler. On SD3-style configs you also get clip_g and t5xxl. Feed a literal string or wire from a String Mecha Hyper.
  • recipe (output) - only that component's keys, same merge space as the input.

Where this shines: swapping a VAE into a recipe that doesn't have one, building a "UNet only" merge, or doing component-weighted merging - the pack's Components Params nodes literally build their per-component weights using pick_component under the hood, one float per component, OR'd together. So this node is also the manual version of that: extract the pieces yourself, weigh them yourself, combine them yourself.

Install

Part of the Mecha Merge Node Pack (ljleb/comfy-mecha):

  • ComfyUI Manager → Install Custom Nodes → search "mecha" → 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

Restart ComfyUI; the node lives under mecha. The pack's only dependency is sd-mecha==1.1.7; no downloads.

Common issues

  • The component name must match the config, not the file. A kohya-style LoRA has different component names than an LDM checkpoint. Pick the wrong one and the node errors out with the valid list - check the error rather than guessing.
  • Picking a component that isn't there gives you an empty result. The node is permissive about existing keys and strict about names, but if the recipe's model simply doesn't contain that component's tensors, the output is an empty recipe. A merge that silently produces nothing usually means this.
  • Order matters if you chain it. Pick, then merge, then pick again, and you're slicing a slice. Keep the picks early in the graph and merge late.

Pair Pick with Omit and you can compose any "parts" merge you can imagine - keep the UNet from model A, the VAE from model B, the text encoder from wherever. It's one of those nodes that looks trivial and quietly unlocks a whole workflow.

Categorymecha

Inputs (3)

NameTypeDefaultDescription
a (delta|param|weight)MECHA_RECIPE
component (param)MECHA_RECIPE
merge_checkpointingoptBOOLEANfalseSpeeds up an entire branch of a merge graph that does not change often in exchange of memory. - true: store the first output of this recipe node on cpu memory in fp16. On subsequent workflow executions, as long as the inputs do not change, the cached keys are returned after being cast to the original device and dtype. - false: do not store the output. The recipe and its inputs will re-execute on subsequent workflow executions. Note that the memory used to checkpoint the output is distinct from the cache feature. In general, you probably want to either use this *or* a cache unit, but not both at the same time because the memory adds up. The difference between merge checkpointing and cache is that merge checkpointing completely re-merges from scratch if any input changes. Merge checkpointing is also generally much faster than cache in the fast path.

Outputs (1)

NameTypeDescription
recipeMECHA_RECIPE