Filtered Random LoRA Loader
Random picks from one folder, filtered by keywords
- model
- clip
- MODEL
- CLIP
- positive_text
- negative_text
- positive
- negative
- preview
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 like1.0or 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 onsearch_in_metadatain 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.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| clip | CLIP | — | |
| token_normalization | COMBO | none | 4 options: none, mean, length, length+mean |
| weight_interpretation | COMBO | comfy | 5 options: comfy, A1111, compel, comfy++, down_weight |
| additional_prompt_positive | STRING | — | |
| additional_prompt_negative | STRING | — | |
| lora_folder_path | STRING | — | |
| include_subfolders | BOOLEAN | true | — |
| unique_by_filename | BOOLEAN | true | — |
| keyword_filter | STRING | — | |
| filter_mode | COMBO | AND | 2 options: AND, OR |
| search_in_metadata | BOOLEAN | false | — |
| model_strength | STRING | 1.0 | — |
| clip_strength | STRING | 1.0 | — |
| num_loras | INT | 10–20 | — |
| trigger_word_source | COMBO | json_combined | 4 options: json_combined, json_random, json_sample_prompt, metadata |
| seed | INT | 00–18446744073709550000 | — |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |
| CLIP | CLIP | — |
| positive_text | STRING | — |
| negative_text | STRING | — |
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |
| preview | IMAGE | — |