Nodes/RandomLoRALoader/Filtered Random LoRA Loader
ComfyUI Node

Filtered Random LoRA Loader

Random picks from one folder, filtered by keywords

By shin131002·Created 10 months ago·Updated 27 days ago· 3
Filtered Random LoRA Loader
  • model
  • clip
  • MODEL
  • CLIP
  • positive_text
  • negative_text
  • positive
  • negative
  • preview
  • lora_text
  • keyword
◄token_normalizationnone►
◄weight_interpretationcomfy►
◄additional_prompt_positive►
◄additional_prompt_negative►
◄lora_folder_path►
◄include_subfolderstrue►
◄unique_by_filenametrue►
◄keyword_filter►
◄filter_modeAND►
◄search_in_metadatafalse►
◄model_strength1.0►
◄clip_strength1.0►
◄num_loras1►
◄trigger_word_sourcejson_combined►
◄seed0►

The sibling to Random LoRA Loader, for a different kind of hoarder. If you keep every LoRA you've ever downloaded in one big folder and never clean it up, this is the node for you: it searches that folder by keyword and then picks a random LoRA from whatever matches. Same core idea - random LoRA, trigger words handled for you - but the selection is driven by a search box instead of by folder structure.

It's the one I'd reach for in the pack when your collection has outgrown manual organization. You get a huge folder of anime style LoRAs and want to randomize within that category? keyword_filter: "anime style", done. You want a random character LoRA from the same flat pile? Chain a second instance with keyword_filter: "character" after the first one - the README explicitly recommends serial chaining, and it works because each instance applies to whatever MODEL/CLIP it receives and hands the result on.

How it works

Mechanically it's the same engine as Random LoRA Loader: scan a folder, read metadata (.metadata.json from ComfyUI Lora Manager first, then .info from Civitai Helper, then embedded safetensors tags), pull trigger words, apply strengths to MODEL and CLIP, emit cleaned-up conditioning. The difference is the filter stage in front of the random pick. Keywords are space-separated and ANDed by default ("anime girl" matches files containing both), or you switch filter_mode to OR. Put quotes around a phrase and it matches exactly: '"anime style" detailed'. Leave search_in_metadata off and it's a fast filename search; flip it on and it also searches the JSON and embedded metadata - slower the first time (roughly 2s per 1000 files, 20s at 10k), then instant on repeat thanks to a class-level cache.

The one thing worth understanding before you lean on this: it's only as good as your filenames or your metadata. If everything's named model_v01.safetensors and the metadata is empty, filtering has nothing to bite on.

The inputs that actually matter

  • lora_folder_path - one absolute path to your collection.
  • keyword_filter + filter_mode (AND/OR) - the whole point of the node.
  • num_loras - how many to select from the filtered set (0–20).
  • model_strength / clip_strength - fixed like 1.0 or a random range like "0.6-0.9" (0.1 steps, negatives supported).
  • seed - standard ComfyUI seed control for reproducible picks.
  • search_in_metadata - flip on only when filenames aren't enough.

Outputs are the pack standard: MODEL, CLIP, positive/negative CONDITIONING, positive_text/negative_text strings, and a preview IMAGE batch of the selected LoRAs' thumbnails. Wire MODEL/CLIP to the KSampler and positive_text to a Show Text node and you'll see exactly which LoRA got picked and which trigger words rode along.

Install

ComfyUI Manager (search "RandomLoRALoader") or:

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

Restart ComfyUI. No heavy dependencies - just ComfyUI's bundled libraries. Optional pip install opencv-python only affects video previews. Same as the rest of the pack: SD1.5/SDXL only, no Flux, SD3, or Pony support, and no model files to download.

Troubleshooting

  • "No LoRAs found." This is almost always the filter, not the path. Broad keywords like "anime" match nothing if your filenames don't contain the word - try filter_mode: OR, drop to one keyword, or turn on search_in_metadata in case the tags live in metadata rather than filenames. Phrase syntax trips people too: quotes are how you make a phrase, and they matter inside the field.
  • Selection feels unrandom. With a tiny filtered set the same pick repeats; give the filter room to work or chain instances.
  • Slow first run. That's the metadata cache warming up on a big folder. Second run is the fast one.
  • No trigger words. Same story as the original node: metadata must exist to be read. LoRAs with nothing next to them and nothing embedded will come out tagless.
  • Zero support promised. Small MIT pack, no maintenance guarantees - the repo says as much up front. It's a one-file search-and-pick node, so if it ever breaks you can read the source and fix it yourself.
Categoryloaders

Inputs (17)

NameTypeDefaultDescription
modelMODEL—
clipCLIP—
token_normalizationCOMBOnone4 options: none, mean, length, length+mean
weight_interpretationCOMBOcomfy5 options: comfy, A1111, compel, comfy++, down_weight
additional_prompt_positiveSTRING—
additional_prompt_negativeSTRING—
lora_folder_pathSTRING—
include_subfoldersBOOLEANtrue—
unique_by_filenameBOOLEANtrue—
keyword_filterSTRING—
filter_modeCOMBOAND3 options: AND, OR, OFF
search_in_metadataBOOLEANfalse—
model_strengthSTRING1.0—
clip_strengthSTRING1.0—
num_lorasINT10–20—
trigger_word_sourceCOMBOjson_combined4 options: json_combined, json_random, json_sample_prompt, metadata
seedINT00–18446744073709550000—

Outputs (9)

NameTypeDescription
MODELMODEL—
CLIPCLIP—
positive_textSTRING—
negative_textSTRING—
positiveCONDITIONING—
negativeCONDITIONING—
previewIMAGE—
lora_textSTRING—
keywordSTRING—