Nodes/LoRA Optimizer/Merged LoRA to Hook
ComfyUI Node

Merged LoRA to Hook

Apply your merged LoRA to one prompt, not the whole model

By ethanfel·Created 5 months ago·Updated 23 days ago· 135
Merged LoRA to Hook
  • lora_data
  • prev_hooks
  • hooks

Normally, feeding LoRA Optimizer's output into your sampler applies the merge globally - every part of the image, positive and negative conditioning alike, sees the same merged model. Sometimes you don't want that. Maybe you want the merged style LoRA to hit your positive prompt but leave the negative conditioning on the clean base model, or you want it active only during part of the sampling schedule. That's a job for ComfyUI's hook system, and this node is the bridge between LoRA Optimizer's output and it.

What it is and why you'd use it

Merged LoRA to Hook wraps the optimizer's merged patches as a HOOKS object instead of applying them directly to MODEL/CLIP. Hooks in ComfyUI attach per-conditioning rather than globally, through a node like Cond Set Props. Once you've done that, the merged LoRA only affects generation where that specific conditioning is active - which opens up a few things a global merge can't do: different merged LoRAs on positive vs. negative conditioning, a LoRA that only kicks in during certain sampling steps via hook keyframes, or region-specific application when combined with area conditioning. It's also the way to keep your base MODEL output completely unpatched while still using the merge somewhere downstream - useful if part of your graph genuinely needs the clean base model.

How it works

It's a small, single-purpose adapter - it doesn't do any merging itself. LoRA Optimizer (or AutoTuner, or Merge Selector) already computed the merged patches and exposed them as LORA_DATA; this node just repackages that into the HOOKS type ComfyUI's conditioning system expects.

The inputs and outputs that matter

  • lora_data (required) - connect the lora_data output from LoRA Optimizer (or any node that produces one - AutoTuner, Extract from Model, Merge Selector all emit it too).
  • prev_hooks (optional) - chain in an existing HOOKS object if you're stacking this on top of hooks from elsewhere in your graph, rather than starting fresh.

Output: hooks - connect it to Cond Set Props (or a similar node that accepts HOOKS) on the conditioning branch you want the merged LoRA to affect.

How to install it

ComfyUI Manager: search "LoRA Optimizer", install, restart. Manually:

cd ComfyUI/custom_nodes/
git clone https://github.com/ethanfel/ComfyUI-LoRA-Optimizer.git

Restart ComfyUI - nodes appear under loaders. Nothing to download; this node just repackages a merge you've already computed.

Common issues & troubleshooting

The merged LoRA doesn't seem to be doing anything. Check that Cond Set Props (or whatever hook consumer you're using) is actually attached to the conditioning branch feeding your sampler, and that you're not also feeding the unpatched model output from your checkpoint loader straight into KSampler in parallel - hooks only apply where the hooked conditioning is used, so a stray unhooked path bypasses them entirely.

You need this merge computed first. This node is downstream of the actual merge - it doesn't take a lora_stack or a model input, only lora_data. If you haven't run a LoRA Optimizer (or AutoTuner/Merge Selector) node yet to produce that LORA_DATA, there's nothing here to wrap.

Unsure whether you even need this node. If you just want the merged LoRA applied to the whole generation the normal way, you don't - use LoRA Optimizer's model/clip outputs directly into your sampler. Reach for this node specifically when you need the merge scoped to one piece of conditioning rather than the whole run.

CategoryLoRA Optimizer

Inputs (2)

NameTypeDefaultDescription
lora_dataLORA_DATAConnect the lora_data output from LoRA Optimizer.
prev_hooksoptHOOKSOptional: chain with existing hooks.

Outputs (1)

NameTypeDescription
hooksHOOKS