Extract prompt from LoRA tag
Turn a LoRA filename into prompt keywords, automatically
- ui_widget
- keywords
- keywords_count
- keywords_list
- keywords_count_list
Here's a workflow problem nobody sells you a node for: you load a LoRA and then have to type its description into the prompt by hand. LF_ExtractPromptFromLoraTag automates that step - if your LoRA files are named the way this node expects, it splits the filename apart and hands you back the keywords, pre-formatted and ready to wire into your prompt.
The mechanism lives in a naming convention. If your LoRA is called portrait_SEP_softlight_SEP_bokeh.safetensors, the node uses that SEP separator to break the name into its meaningful chunks and returns portrait, softlight, bokeh as a usable keyword string. It's the same trick the author described when he launched the refactor of this pack - "extract keywords from a LoRA tag, if the files are named accordingly." The whole node is basically a bet on tidy naming, and it pays off if you're willing to rename your files.
How it works
Two inputs. tag is the LoRA tag to convert - multiline, so it can hold a batch. separator defaults to SEP; change it if your convention uses something else, like _ or +. There's no hidden parsing magic, just a split-and-strip.
The four outputs are designed for different wiring patterns:
keywords- the combined keyword string, comma-separated. This is the one you probably feed into your prompt.keywords_count- how many keywords ended up in there.keywords_list- the keywords as a list, one per element, for nodes that iterate.keywords_count_list- the counts per tag as a list, when you passed several tags in.
If you're batch-testing LoRAs - loading five of them and wanting each one's trigger words in the prompt without hand-editing - this node plus a loop is the clean solution. It also pairs naturally with the pack's other "work from a filename" utilities, because this suite is big on driving the graph from well-named files.
Installing it
Part of LF Nodes, so:
cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/comfyui-lf
Restart, or use ComfyUI Manager and search LF Nodes. No model downloads; the pack deps are minimal (numpy, Pillow, opencv-python, requests, torch).
Gotchas
The whole thing depends on your filenames being consistent. If your LoRAs are named myrandomname_v1, there are no keywords to extract and you'll get one big blob. The node is only as smart as your naming scheme - which is exactly what the tooltips say, and worth knowing before you build a workflow around it.
And the pack note: comfyui-lf is legacy (frozen Feb 2025); active development moved to lucafoscili/lf-nodes. The frozen version works, but the new repo is where this class of utility keeps evolving.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| tag | STRING | The LoRA tag to be converted. | |
| separator | STRING | SEP | String separating each keyword in a LoRA filename. |
| ui_widgetopt | KUL_CODE | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| keywords | STRING | — |
| keywords_count | INT | — |
| keywords_list | STRING | — |
| keywords_count_list | INT | — |