Nodes/ComfyUI-Creepy_nodes/LoRA DB Builder (Creepybits)
ComfyUI Node

LoRA DB Builder (Creepybits)

Never hunt for LoRA trigger words again

By Creepybits·Created about a year ago·Updated 2 months ago· 32
LoRA DB Builder (Creepybits)
    • found_trigger_words
    lora_name
    force_fetchfalse

    Every LoRA you've downloaded came with trigger words - the rare tokens you have to type into your prompt to activate what the LoRA was trained to do ("rare-token trigger words" is the standard training practice, as the KB's LoRA training notes confirm). And every LoRA's trigger words are buried somewhere you can't remember: the Civitai page, a README, a forum post you'll never find again.

    LoRA DB Builder solves the remembering problem the smart way. You pick a LoRA from a dropdown, and it calculates the file's SHA256 hash, asks Civitai's API "have you seen this file, and what was it trained with?", and saves the answer into a local JSON database. One run per LoRA, and from then on you have a permanent offline lookup for every file you've catalogued.

    How it works

    Three steps under the hood:

    1. Hash. It walks your LoRA folders to find the file and computes its SHA256.
    2. Ask Civitai. It hits https://civitai.com/api/v1/model-versions/by-hash/{hash} - the same lookup Civitai's own site uses. If the hash matches a model version, the response includes trainedWords, the official trigger list.
    3. Store. The result is written into assets/Lora_db/lora_triggers.json in the pack, keyed by LoRA filename. If the hash finds nothing, it stores an empty list so you know it's been checked.

    Inputs: lora_name (dropdown of your LoRA files, with a "None" option) and force_fetch (re-query Civitai even if the entry already exists - useful if a model page was updated). Output: found_trigger_words, a comma-joined string you can copy or wire into a prompt.

    This is the write half of a two-node system. The companion LoRA Trigger Lookup reads the same database for instant, offline access - run the builder once per LoRA, then use the lookup forever.

    The honest caveats

    This depends on your LoRA being on Civitai and its page having the trigger words listed. LoRAs from Hugging Face, Patreon drops, or anywhere else won't match a hash. Also note the dropdown lists only the base filename of each LoRA - if you have foo.safetensors in two different subfolders, they both show up as foo.safetensors and the builder will find the first one it walks into. Keep filenames unique or rename before cataloguing.

    The KB's Civitai panel is a reminder that the platform's mood changes - but the by-hash API endpoint is a stable, public lookup that doesn't require you to have an account or an API token.

    Installing it

    Part of ComfyUI-Creepy_nodes:

    • ComfyUI Manager: search "Creepy_nodes" and install.
    • Manual:
      cd ComfyUI/custom_nodes
      git clone https://github.com/Creepybits/ComfyUI-Creepy_nodes.git
      

    Restart ComfyUI. Needs requests (already in the pack's requirements; ComfyUI ships it too). Requires internet access for the Civitai call.

    Troubleshooting

    Empty output for a LoRA you're sure is on Civitai: check the console - the node prints whether the hash lookup succeeded or found nothing. If it says the hash returned nothing, either the LoRA was re-uploaded (different file, different hash) or the page simply has no listed trigger words. And if the database file ever goes missing or gets corrupted, don't panic - the builder recreates it on the next run. It's a cache, not a critical asset.

    CategoryCreepybits/Database

    Inputs (2)

    NameTypeDefaultDescription
    lora_nameCOMBO1 options: None
    force_fetchBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    found_trigger_wordsSTRING