ComfyUI Node

LoRA String Adapter

The Glue That Lets a String Drive a Load LoRA

By hubentu·Created about a year ago·Updated 12 months ago· 2
LoRA String Adapter
    • lora_name
    lora_name_string

    Stock ComfyUI's Load LoRA node takes its lora_name from a dropdown of your installed LoRAs. That's fine when you pick by hand. It's a wall when you want the LoRA chosen by a string - from a text box, a saved value, or another node. You can't just wire a plain STRING into a dropdown input and expect it to seat.

    LoRA String Adapter is the shim that fixes that. It takes any string, and re-types it as the exact type Load LoRA's dropdown expects, so the connection works and the string becomes the loaded LoRA. It doesn't load anything itself. It's a name adapter, and the whole trick is in the type.

    How it works

    The mechanism is almost rude in its simplicity: the node's return type is folder_paths.get_filename_list("loras") - literally the list of your installed LoRA filenames, which is the same combo type Load LoRA's input uses. So its output seats into the stock node's lora_name the same way the dropdown's own values would. At execution it takes your string, checks it against that list, and:

    • Matches → returns your string.
    • No match → prints a warning to the console and returns the first available LoRA as a fallback.
    • Empty string → same fallback.

    The inputs and output

    • lora_name_string - the name you want to load, e.g. my_character.safetensors. Match it exactly, extension included.

    Output: lora_name, typed to plug straight into a standard Load LoRA node.

    Where it fits

    Pair it with the pack's MultiLoRAnameLoader (which hands you a filename by index from a list you type) and you get the dynamic-selection pattern: pick a name by number, adapt it to the right type, load with the stock node. Some versions of ComfyUI will let a plain string connect into a combo input anyway, which makes this adapter feel redundant - but "depends on your version" is exactly the fragility this node exists to remove. If your string-to-dropdown connection ever refuses to seat, this is the workaround that makes it not-your-problem.

    The honest caveat

    That silent fallback can bite. A typo doesn't error - it quietly loads your first alphabetical LoRA instead, and you'll only notice the console warning. If a generation suddenly carries a style you didn't ask for, check the console for "not found" before you start re-randomizing seeds. And keep expectations realistic: this is a niche utility with basically no community footprint. Three search impressions a month. It's a tiny piece of plumbing that exists so one specific connection works - and for that one job it does exactly what it says.

    Installing it

    ComfyUI Manager, search "loras-loader" (or "Multiple LoRA Loader"), install, restart. By hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/hubentu/ComfyUI-loras-loader
    

    No dependencies, no model downloads, no requirements.txt. The entire node is about forty lines of Python.

    Categoryutils

    Inputs (1)

    NameTypeDefaultDescription
    lora_name_stringSTRING

    Outputs (1)

    NameTypeDescription
    lora_name