Nodes/ComfyUI-XJNodes/Conditional Lora Loader
ComfyUI Node

Conditional Lora Loader

One toggle turns every LoRA in your stack on or off

By alexjx·Created 10 months ago·Updated 4 months ago· 0
Conditional Lora Loader
  • model
  • MODEL
enabledtrue

LoRA stacks get out of hand fast: four or five LoRAs chained in a row, and every time you want to A/B test "with style vs. without" you're muting nodes one by one. XJConditionalLoraLoader solves that with a single enabled boolean that turns the whole stack on or off. Flip it, re-run, compare. No hunting through the graph.

It's the ComfyUI-XJNodes take on rgthree's famous Power Lora Loader - same idea of stacking multiple LoRA slots with individual strength controls, but with a coarser, simpler switch: either all of them apply, or none do. There's no per-slot toggle. That's a trade-off, and for a lot of workflows it's the right one.

How it works

The node builds its inputs dynamically: a model input plus an enabled boolean, and then an open-ended set of lora_1, lora_2, lora_3, … slots, each of which is a small object holding a lora name and a strength. When enabled is true, it walks those slots in order and applies each non-"None", non-zero-strength LoRA to the model. When false, it short-circuits and hands the model back untouched - no loading, no patching, no wasted VRAM.

The important implementation detail: each LoRA is applied through ComfyUI's own LoraLoaderModelOnly. That means this loader patches only the model, not the CLIP/text-encoder side. It's the right call when you're loading style or detail LoRAs after your conditioning is already built, but if you're using a LoRA with a trigger phrase you want encoded into conditioning, you'll want a CLIP-touching loader for that part instead. There's also a right-click refresh loras option on the node so newly dropped-in LoRA files show up without a full ComfyUI restart.

The inputs that matter

  • model (MODEL) - the checkpoint/UNet to patch.
  • enabled (BOOLEAN, default true) - the master switch.
  • lora_1, lora_2, … - each with a lora dropdown and strength. Add more slots as you need them.
  • Output: MODEL - the patched (or untouched) model.

Installing it

Part of ComfyUI-XJNodes:

cd ComfyUI/custom_nodes
git clone https://github.com/alexjx/ComfyUI-XJNodes

then restart ComfyUI (or ComfyUI Manager → search ComfyUI-XJNodes). No models to download; the LoRAs you load are your own.

Common issues

The big one is the model-only design: don't expect prompt-side effects. If your LoRA introduces a trigger word and you're feeding the same prompt in both branches, the enabled comparison won't show the "with vs. without trigger" difference you might expect - wire your text encoding properly. Also, enabled only works if the node actually re-runs; if ComfyUI thinks nothing changed, toggle it or hit run again. And if a LoRA silently doesn't apply, check the console: the node logs a [XJConditionalLoraLoader] skip message when a name isn't found in your loras folder.

CategoryXJNodes/lora

Inputs (2)

NameTypeDefaultDescription
modeloptMODEL
enabledoptBOOLEANtrue

Outputs (1)

NameTypeDescription
MODELMODEL