Nodes/RandomLoRALoader/Random LoRA Loader
ComfyUI Node

Random LoRA Loader

Roll the dice on style, character, and concept every run

By shin131002·Created 8 months ago·Updated 8 months ago· 2
Random LoRA Loader
  • model
  • clip
  • MODEL
  • CLIP
  • positive_text
  • negative_text
  • positive
  • negative
  • preview
token_normalizationnone
weight_interpretationA1111
additional_prompt_positive
additional_prompt_negative
lora_folder_path_1
include_subfolders_1true
unique_by_filename_1true
model_strength_11.0
clip_strength_11.0
num_loras_11
lora_folder_path_2
include_subfolders_2true
unique_by_filename_2true
model_strength_21.0
clip_strength_21.0
num_loras_20
lora_folder_path_3
include_subfolders_3true
unique_by_filename_3true
model_strength_31.0
clip_strength_31.0
num_loras_30
trigger_word_sourcejson_combined
seed0

Random LoRA Loader is the node for the "I want to be surprised, but I don't want to babysit the prompt" workflow. You point it at up to three folders - say one for styles, one for characters, one for concepts - and every time you queue it grabs a random LoRA from each, applies them to your MODEL and CLIP, and also drops the trigger words into the prompt for you. Queue five times, get five genuinely different combinations.

That last part is the whole trick. Anyone who's tried to randomize LoRAs before hits the same wall: a random LoRA is useless unless its trigger words ride along, and hand-maintaining a text file of every LoRA's tags gets old fast. The community keeps asking for exactly this (a recurring r/comfyui request, and the standard workaround is a hand-curated wildcard file). This node does the curation for you by reading trigger words out of the metadata files that already ship with your LoRAs.

How it works

Each of the three groups has a folder path and a count. On execution the node lists .safetensors files in that folder (subfolders included by default), picks num_loras at random without repeating, then reads metadata for each pick: the .metadata.json file ComfyUI Lora Manager writes, then the .info file from Civitai Helper, then metadata embedded in the safetensors itself. From that it pulls trigger words and sample prompts, applies your strengths to MODEL and CLIP, and builds the text and CONDITIONING outputs with the LoRA syntax stripped so you don't get stray <lora:...> tokens turned into garbage words by the CLIP tokenizer.

One big compatibility asterisk, stated right on the repo: SD1.5 and SDXL only. Not Flux, not SD3, not Pony. If you live on modern architectures this isn't your node - it was built around the SD1.5/SDXL U-Net, where the LoRA ecosystem is still enormous and cheap to experiment with.

The inputs that actually matter

You don't touch most of these on day one. The ones you will:

  • lora_folder_path_1/2/3 - absolute paths to your style, character, and concept folders. num_loras_1/2/3 - how many to pull from each (0 = skip that group).
  • model_strength_X / clip_strength_X - fixed values like 1.0, or random ranges like "0.6-0.9" (picks from 0.6, 0.7, 0.8, 0.9 in 0.1 steps). Negatives work too: "-0.8--0.3" is a real negative LoRA range. MODEL strength controls the visual weight; CLIP strength controls how hard the trigger words push the prompt.
  • seed - standard ComfyUI seed control, so a fixed seed gives you a reproducible pick.
  • trigger_word_source - json_combined (default, merges all tag sources), json_random, json_sample_prompt, or metadata (embedded only).

The outputs are MODEL and CLIP (straight into your KSampler), positive and negative CONDITIONING (into Set Conditioning or the sampler), positive_text / negative_text (wire to a Show Text node to see what got selected - worth doing while you learn), and preview (an IMAGE batch of the chosen LoRAs' thumbnails). It also plays well with Wildcard Encode from the Inspire Pack: feed its populated_text into additional_prompt_positive and the node strips any LoRA syntax out.

Install

ComfyUI Manager (search "RandomLoRALoader") or:

cd ComfyUI/custom_nodes
git clone https://github.com/shin131002/RandomLoRALoader

Restart ComfyUI. That's it - core dependencies are just the Python standard library plus what ComfyUI already bundles. No model downloads. The only optional add-on is pip install opencv-python, and it only matters if you want video previews to show instead of a black frame; still images, GIFs, and WebP work without it.

Troubleshooting

  • Nothing selected. Check the folder path is absolute, that .safetensors files actually exist there, and that include_subfolders_1 is on if your LoRAs live in subfolders. An empty or bogus folder is skipped silently, which is friendly but easy to misread.
  • No trigger words in the output. The node can only pull what the metadata has. If your LoRAs have no .metadata.json or .info next to them and no embedded tags, try trigger_word_source: metadata or just accept the prompt will be tagless.
  • Weights all going to 1.0. That was a real v1.1.0 bug with negative values; v1.2.0 fixed it. If you're on an old install, update.
  • Expect zero support. This is a small, fresh, MIT-licensed pack (v1.2.0, no community footprint) with an explicit no-support policy - if something breaks you fork it. Fair trade for a free randomizer that runs on your own folder.
Categoryloaders

Inputs (26)

NameTypeDefaultDescription
modelMODEL
clipCLIP
token_normalizationCOMBOnone4 options: none, mean, length, length+mean
weight_interpretationCOMBOA11115 options: comfy, A1111, compel, comfy++, down_weight
additional_prompt_positiveSTRING
additional_prompt_negativeSTRING
lora_folder_path_1STRING
include_subfolders_1BOOLEANtrue
unique_by_filename_1BOOLEANtrue
model_strength_1STRING1.0
clip_strength_1STRING1.0
num_loras_1INT10–20
lora_folder_path_2STRING
include_subfolders_2BOOLEANtrue
unique_by_filename_2BOOLEANtrue
model_strength_2STRING1.0
clip_strength_2STRING1.0
num_loras_2INT00–20
lora_folder_path_3STRING
include_subfolders_3BOOLEANtrue
unique_by_filename_3BOOLEANtrue
model_strength_3STRING1.0
clip_strength_3STRING1.0
num_loras_3INT00–20
trigger_word_sourceCOMBOjson_combined4 options: json_combined, json_random, json_sample_prompt, metadata
seedINT00–18446744073709550000

Outputs (7)

NameTypeDescription
MODELMODEL
CLIPCLIP
positive_textSTRING
negative_textSTRING
positiveCONDITIONING
negativeCONDITIONING
previewIMAGE