Nodes/comfyui-mudknight-utils/Conditional Lora (full-pipe)
ComfyUI Node

Conditional Lora (full-pipe)

A LoRA that only loads when your prompt asks for it

By mudknight·Created 8 months ago·Updated 2 months ago· 1
Conditional Lora (full-pipe)
  • full_pipe
  • full_pipe
lora_name
strength_model1.00
strength_clip1.00
substring

Here's a workflow problem you didn't know you had until you hit it: you want one shared graph that renders lots of different subjects, and only some of them need a specific LoRA loaded. Conditional Lora (full-pipe) solves it with a single string check - if a substring you specify appears in the pipe's positive text, the LoRA gets applied; otherwise it's a passthrough and the pipe flows on untouched.

The mechanism is exactly what the tooltip on the node says: "Add lora if substring is in positive_text." It reads the pipe's positive slot - which, in this pack's convention, carries both the conditioning and the plain text via the prompt nodes - checks whether your substring is in it, and only then applies the LoRA with strength_model / strength_clip (both default 1.0). The model is cloned when applied, so a skipped condition costs you nothing in VRAM.

The inputs that matter

  • substring - the trigger. Make it a stable token, not a word that'll show up in a stray comment. If your Anima workflow uses a LoRA only for the "mic" character, a substring of holding microphone is more reliable than mic (which appears inside "microphone" - though that still works, substrings are greedy).
  • lora_name, strength_model, strength_clip - same as the unconditional Load LoRA (full-pipe).

Output is the updated full_pipe. It's the right tool when you're building one reusable graph for a batch of prompts with mixed requirements - one detail, several conditionals, and each LoRA only engages for the prompts that name it.

Installing it

Same pack: ComfyUI Manager (search comfyui-mudknight-utils) or:

cd ComfyUI/custom_nodes
git clone https://github.com/mudknight/comfyui-mudknight-utils

Restart and you're done. No extra dependencies.

Where people get burned

The trap is expecting it to fire when the prompt text hasn't actually flowed into the pipe. The check runs against the pipe's positive text, so the substring match needs the text there - if your prompt is only ever baked into conditioning upstream and never stored in the pipe's positive slot, the check sees an empty string and the LoRA never loads. Keep the positive text in the pipe (the pack's prompt nodes store it there) and test with a substring you know is present. And remember: substring matching is dumb and literal - case and spacing matter, so keep the trigger spelling identical to what your prompts use.

Categorymudknight/pipe

Inputs (5)

NameTypeDefaultDescription
full_pipeFULL_PIPE
lora_nameCOMBO0 options:
strength_modelFLOAT1.00-20–20
strength_clipFLOAT1.00-20–20
substringSTRING

Outputs (1)

NameTypeDescription
full_pipeFULL_PIPE