Nodes/PG Nodes/Create LoRA Hook
ComfyUI Node

Create LoRA Hook

One hook, both paths, two strengths

By GizmoR13·Created 11 months ago·Updated 11 months ago· 16
Create LoRA Hook
  • lora_bridge
  • prev_hooks
  • HOOKS
which_loralora_1
strength_model1.00
strength_clip1.00

Most LoRAs want to touch both halves of the pipeline - the text encoder and the UNet - and the two halves don't always want the same strength. PgCreateHookLoraBoth is the PG Nodes node for that job: it builds a non-destructive HOOKS bundle from a LoRA sitting in a LORA_BRIDGE, with an independent strength for the model path and the clip path, ready to hand to Set Model Hooks / Set Clip Hooks.

The whole point of building it as a hook rather than a merge is that nothing is baked. The LoRA weights stay in the bridge; the hook is just an instruction that says "apply this much on the model side, that much on the clip side, at these timesteps." Change strength_model or strength_clip and the next run reflects it immediately - no reload, no re-merge. That's the flexibility the pack's merge nodes deliberately trade away for speed.

How it works

Under the hood it calls ComfyUI core's comfy.hooks.create_hook_lora() with your chosen bridge slot's LoRA and the two strengths, then combines the result onto a HookGroup via clone_and_combine. That group is what flows out of the HOOKS output. ComfyUI's hooks machinery evaluates it during sampling - the clip strength at conditioning time, the model strength on the UNet path - so the "both" is real: one node, one LoRA, both sides.

It also takes an optional prev_hooks input, and this is worth knowing: hooks chain. Feed the output of one PgCreateHookLoraBoth into the next node's prev_hooks and you stack LoRAs non-destructively, each keeping its own strengths. Same trick works with the clip-only and model-only variants, so you can mix a "both" LoRA with a clip-only one in a single chain.

Inputs

  • lora_bridge - the bundle from a LoRA Bridge Loader; the actual LoRA file lives here, not in this node.
  • which_lora - which slot (lora_1lora_4) of the bridge to hook. Defaults to lora_1.
  • strength_model and strength_clip - the two strengths, both -20 to 20 (wider than the merge nodes' -100–100, but honestly anything past ~2 is a curiosity). If both are 0, the node returns an empty hook group and nothing gets applied.
  • prev_hooks (optional) - a HOOKS group to chain onto.

The single HOOKS output is the thing you wire into PgSetModelHooks and/or PgSetClipHooks.

Install

Ships in PG Nodes: ComfyUI Manager → "PG Nodes" → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/GizmoR13/PG-Nodes

Common issues

If you see RuntimeError: comfy.hooks module unavailable, your ComfyUI predates the core hooks API - update it. If the hook builds fine but does nothing, you've probably got an empty bridge slot (check which_lora against what's loaded in the Bridge Loader) or you forgot the second half of the chain: a created hook does nothing until a Set Hooks node attaches it. And a trap worth naming: if you chain this into prev_hooks and wire the output into a Set Hooks node, you'll apply it twice.

CategoryPG/Lora

Inputs (5)

NameTypeDefaultDescription
lora_bridgeLORA_BRIDGE
which_loraCOMBOlora_14 options: lora_1, lora_2, lora_3, lora_4
strength_modelFLOAT1.00-20–20
strength_clipFLOAT1.00-20–20
prev_hooksoptHOOKS

Outputs (1)

NameTypeDescription
HOOKSHOOKS