Nodes/OmniNodes/Trigger Word Extractor 🏹
ComfyUI Node

Trigger Word Extractor 🏹

The LoRA filename decoder ring

By TensorVizionΒ·Created 3 months agoΒ·Updated about 8 hours agoΒ· 0
Trigger Word Extractor 🏹
    • trigger_word
    • cleaned_tokens
    β—„filename_or_pathmy_character_v2_sdxl_fp16.safetensorsβ–Ί

    There's a moment every LoRA hoarder knows: you downloaded my_character_v2_sdxl_fp16.safetensors a month ago, and now you can't remember the trigger word that activates it. The Trigger Word Extractor from TensorVizion/OmniNodes is a small utility that guesses it from the filename itself - splitting it on separators, stripping the noise tokens (v2, sdxl, fp16, pruned, epoch markers, and similar), and returning the cleaned remainder as both a trigger-word guess and a human-readable token string.

    So my_character_v2_sdxl_fp16.safetensors becomes my_character as the trigger guess, and my character as the cleaned tokens. It's the kind of node that's perfect for automation: when you're wiring up a batch of LoRAs by filename alone, and you want each one's presumed trigger dropped into a prompt automatically.

    The honest caveat

    Read the mechanism carefully, because this is where people get burned: it's parsing a filename, not reading the file. The real trigger word lives in the LoRA's training - it's the rare token the model was taught to associate with the concept (the community standard is rare alphanumeric tokens like ch9ractername, precisely so they don't collide with normal words). The filename is only a hint about that. If the file was renamed, or the author named it after the character rather than the token, the extractor's guess can be flat wrong.

    The file's own metadata, or the CivitAI page, is the ground truth. This is the same gap rgthree's Power Lora Loader fills by reading trigger words off the file or fetching them from CivitAI and caching them locally. The OmniNodes take is more mechanical: if you're writing automation and your naming convention is disciplined, this gives you a free guess without a network call. If your naming is chaos, treat the output as a suggestion to verify.

    Inputs and outputs

    One input: filename_or_path (a string - it takes either a bare filename or a full path and pulls the basename). Two outputs:

    • trigger_word - the underscore-joined guess, ready to paste into a prompt as-is.
    • cleaned_tokens - the same content space-separated, easier to read or re-join with your own separator.

    Install

    It ships with OmniNodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TensorVizion/OmniNodes
    

    Or ComfyUI Manager β†’ OmniNodes β†’ restart. Pure Python standard library, no dependencies. One category quirk: most of the pack's model nodes live under TensorVizion/Model Utilities, but this one (along with a few metadata nodes) reports TensorVizion/Model - so it shows up in a separate submenu. Search the name if you can't spot it.

    Troubleshooting

    • Wrong word entirely - not a bug, a heuristic. Check the LoRA's metadata or CivitAI page for the trained token. (The pack's own LoRA Info Inspector is a better source when the file has metadata.)
    • Output looks empty - a filename that's all noise tokens (v1_fp16_pruned.safetensors) leaves nothing to extract; the code falls back to the original basename so you still get something.
    • Node missing - restart and look for [OmniNodes] in the terminal log.

    Reach for it when you're scripting prompt assembly from filenames, not when you need certainty. For the latter, read the metadata.

    CategoryTensorVizion/Model

    Inputs (1)

    NameTypeDefaultDescription
    filename_or_pathSTRINGmy_character_v2_sdxl_fp16.safetensorsβ€”

    Outputs (2)

    NameTypeDescription
    trigger_wordSTRINGβ€”
    cleaned_tokensSTRINGβ€”