Nodes/PPWildCard/Lora detection
ComfyUI Node

Lora detection

The 'LoRA detector' that's really just one string check

By kohs100·Created about a year ago·Updated 2 months ago· 0
Lora detection
    • output
    match
    o1.00
    x0.00
    input

    The name is a lie. PPWCLoraDetector doesn't scan your models folder, sniff embeddings, or reach into your LoRA loader. It's a one-line string check wearing a fancy hat: if a pattern you type appears anywhere in a prompt string, it outputs a float; otherwise it outputs a different float. That sounds trivial until you're doing random LoRA swapping, at which point it's the piece that stops your batch from turning into noise.

    Here's the problem it solves. You've built a wildcard workflow where each run picks a random LoRA plus the trigger tags that go with it. Without a gate you've got two options: apply the LoRA at full strength every run, so a style LoRA bleeds in even when the random pick didn't call for it, or manually rewire the graph per image. The middle path is letting the prompt itself decide, and that's this node's whole job.

    Wire the resolved prompt into input, type the LoRA's tag into match, and the node returns o (default 1.0) when that tag is present or x (default 0.0) when it isn't. Multiply that float by your base LoRA strength and feed the result into the loader's strength input: when the wildcard picked that LoRA it fires at full strength; when it didn't, the multiplication zeroes it out. Run a batch of 32 and every frame gets its own coherent prompt-plus-LoRA pairing with no manual edits. This is the workflow r/comfyui has been hand-rolling since 2024 - random LoRA stacks that carry their own trigger words, in the style people used to wire with Impact Pack wildcards and comfyui_lora_tag_loader - just with the matching done inside the graph instead of across two nodes and a text file.

    Only four inputs matter, and three are self-explanatory:

    • match - the token you're hunting for. Plain substring search, so be specific: lora:add_detail beats lora, which would also fire on lora:anything_else.
    • o and x - the values for detected and not-detected, both clamped 0–1. Defaults of 1 and 0 are exactly what you want for a binary gate.
    • input - a string wired in from your prompt path.

    The single output, output, is a FLOAT, so it slots into any strength or switch input - a LoraLoader's strength, a multiplier on the way in, or any node that takes a 0/1 control. Two honest caveats: the match is case-sensitive and literal (no regex), and o/x are locked to 0–1, so don't plan on outputting a strength of 1.3 from here. Chain a couple of these with different match values and you can gate multiple LoRAs off one prompt - one detector per LoRA, each feeding its own strength.

    Install is the same as the rest of the PPWildCard pack: a single-file pack with zero dependencies, so there's nothing to break. Use ComfyUI Manager and search "PPWildCard", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kohs100/comfyui-ppwc
    

    Then restart ComfyUI. No model files, no requirements.txt, no API key - the only thing it needs is a prompt to look at.

    CategoryHSKOWildcard

    Inputs (4)

    NameTypeDefaultDescription
    matchSTRINGEnter a match target
    oFLOAT1.000–1Determines value to output when detected.
    xFLOAT0.000–1Determines value to output when not detected.
    inputSTRING

    Outputs (1)

    NameTypeDescription
    outputFLOAT