Nodes/PG Nodes/Set Model Hooks
ComfyUI Node

Set Model Hooks

Where your LoRA hooks actually get applied

By GizmoR13·Created 11 months ago·Updated 11 months ago· 16
Set Model Hooks
  • conditioning
  • hooks
  • CONDITIONING
appendtrue

If you've been building the non-destructive LoRA side of PG Nodes, this is the node that makes it real. PgCreateHookLoraModelOnly and friends build a HOOKS bundle describing what you want applied, but a description sitting in a wire does nothing. PgSetModelHooks is the step that takes that bundle and attaches it to your conditioning, so it actually patches the UNet path while sampling runs.

The payoff is the one the whole hooks system exists for: your LoRA strength becomes a live thing instead of a baked-in constant. Because the hook rides along with the conditioning rather than merging weights into the model object, you can change the strength between runs without reloading anything, and - if you drop a Set Hook Keyframes node in between - fade the LoRA in or out at specific points of the denoise. Try that with a plain LoraLoader and you'll be reloading the graph.

How it works

Under the hood it's a wrapper around ComfyUI core's set_hooks_for_conditioning() - the same hooks machinery that powers ComfyUI's own built-in Model Hooks node. The hook group gets merged into your conditioning dicts with append_hooks=True, so when the sampler evaluates those conditionings it finds the LoRA hook waiting on the UNet side and applies the model-path strength at the right timesteps. Non-destructive, reversible by disconnecting, and it respects whatever keyframes the hooks carry.

Inputs

  • conditioning - the positive or negative conditioning from your CLIPTextEncode. This is the hook's delivery vehicle: hook the conditioning, not the model.
  • hooks - the HOOKS bundle from a PgCreateHookLoraModelOnly, PgCreateHookLoraBoth, or PgSetHookKeyframes.
  • append - boolean, default true. Set to false and the node just passes the conditioning through untouched (it's a kill-switch / passthrough, not a "replace" mode - the code always appends when it acts).

Output is CONDITIONING, going to your sampler. There's no MODEL output here, which confuses people coming from a merge-node mindset: the model is affected through the conditioning, which is exactly why this stays non-destructive.

Install

In the PG Nodes pack: ComfyUI Manager → "PG Nodes" → install → restart, or:

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

Common issues

The big one is an old ComfyUI. This node needs the hooks API that lives in ComfyUI core (comfy/hooks.py, or the top-level hooks module). On a stale install you'll get a RuntimeError about set_hooks_for_conditioning unavailable - update ComfyUI before blaming the pack. Also: if you hook the conditioning and see zero effect, check that the upstream create-hook node actually has an effective strength - a hook with both strengths at 0 is considered ineffective and is skipped silently, so you get clean output with no LoRA and no error message. Wire both paths (CLIP hooks on the clip, model hooks here) if you want a LoRA that affects the whole stack; hooking only the model path leaves the text encoder untouched.

CategoryPG/Lora

Inputs (3)

NameTypeDefaultDescription
conditioningCONDITIONING
hooksHOOKS
appendBOOLEANtrue

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING