Nodes/LF Nodes/Parse Prompt with LoRA tags
ComfyUI Node

Parse Prompt with LoRA tags

Parsing keyword-encoded LoRA tags out of a prompt

By lucafoscili·Created 2 years ago·Updated about a year ago· 50
Parse Prompt with LoRA tags
  • ui_widget
  • prompt
  • loras
text
separatorSEP
weight0.50
weight_placeholderwwWEIGHTww

Some LoRA authors bake extra info straight into the filename: trigger words, style tags, sometimes even a suggested weight, all mashed together and separated by some token. It's a neat trick for keeping metadata attached to the file itself instead of a README nobody reads - but it means your prompt ends up full of clunky LoRA references that need unpacking before CLIP ever sees them. That's the one job LF_ParsePromptWithLoraTags does.

You feed it a block of text containing these tags, and it splits each LoRA's filename on a separator (default SEP) to pull out the individual keywords packed inside it. If the filename also carries a weight placeholder - something like wwWEIGHTww sitting in the name where a number should go - the node swaps that placeholder for the actual weight value you set (default 0.5). Two outputs come out the other end: prompt, the cleaned-up text with the LoRA tags resolved into real keywords, and loras, a separate string carrying just the extracted LoRA info. That loras output lines up nicely with the lora_tags field on LF_CivitAIMetadataSetup, if you're already using that node to build CivitAI-compatible metadata for what you generate.

Be honest with yourself about when this node actually does anything: it only has something to parse if your LoRA files follow that separator-plus-placeholder naming convention in the first place. If your LoRAs are just named my_lora_v2.safetensors with no embedded tags, LF_ParsePromptWithLoraTags won't error - it just won't have anything meaningful to extract, and your prompt comes out basically unchanged. It's built for a specific packaging habit, not a general prompt cleaner. If you're chasing that instead, LF_RegexReplace from the same pack is the more general tool.

The four inputs are all you'll touch: text (multiline, the raw prompt), separator (what splits keyword segments - leave it at SEP unless your naming scheme uses something else), weight (the number substituted into the placeholder), and weight_placeholder (the exact placeholder string your filenames use). There's also an optional ui_widget slot - that's LF's own on-canvas code viewer rendering, not something you wire a value into.

Installing it. This node ships inside the LF Nodes pack. Easiest path: open ComfyUI Manager, search "LF Nodes," install, restart ComfyUI. Manual route: cd ComfyUI/custom_nodes && git clone https://github.com/lucafoscili/lf-nodes then restart - note the URL there, not comfyui-lf. The repo comfy.icu links this node to is the pack's old home, which the author has since archived; development moved to lucafoscili/lf-nodes and that's what you actually want cloned if you go the manual route. No models, no heavy Python dependencies - it's pure logic, so install is fast and low-risk.

Where people get tripped up. The biggest one is assuming the node understands LoRA syntax generally - it doesn't parse <lora:name:weight> style tags or anything ComfyUI-native, it's purpose-built for the filename convention described above. Second: if nothing changes in your output prompt, check that your separator actually matches what's in the filename - a mismatched separator means the split just doesn't happen. And if you've cloned the archived comfyui-lf repo and the node is missing after a Manager search turns up nothing, that's the migration biting you - grab it from lf-nodes instead and restart.

Category✨ LF Nodes/Logic

Inputs (5)

NameTypeDefaultDescription
textSTRINGThe input text containing LoRa tags. These tags will be processed and replaced with extracted keywords.
separatorSTRINGSEPCharacter(s) used to separate keywords within the name of a single LoRa file. Helps in extracting individual keywords.
weightFLOAT0.50A weight value associated with LoRa tags, which may influence processing or output significance.
weight_placeholderSTRINGwwWEIGHTwwA placeholder within LoRa tags that gets replaced with the actual weight value during processing.
ui_widgetoptKUL_CODE

Outputs (2)

NameTypeDescription
promptSTRING
lorasSTRING