FERandomLoraSelect
Roll a handful of LoRAs that match a pattern
- output
If you've got a LoRA folder with three hundred files in it, you know the pain: half of them are styles you only want sometimes, and picking them by hand every run is a chore. FERandomLoraSelect is the node that makes your LoRA stack a slot machine - it scans your installed LoRAs, keeps the ones matching a regex you supply, and randomly samples count of them, seeded and reproducible.
It's one of those nodes that sounds like a gimmick until you actually build a "roll the dice" workflow with it - then it becomes the thing that makes a batch of 50 images not look like 50 copies of the same style.
Inputs and output
regex- the filter, a regex matched (case-insensitively) against LoRA filenames. The default is背景|style, which is Chinese for "background" plus "style" - a tell that the author's own folder is full of style and background LoRAs. You'll almost certainly want to replace it with something that matches your collection, e.g.photoreal|portrait.count- how many to pick,1–256, default4.seed- reproducibility. Same seed, same selection.
Output: output, a list of LoRA filenames (the node declares OUTPUT_IS_LIST). It doesn't apply anything itself - it hands you names. You feed them to a LoRA loader that accepts a list (this same pack's FEEncLoraLoader / FEEncLoraAutoLoader are built for exactly that), or to a batch processor.
How it works, and the gotchas
The mechanism is straightforward: list all files in your loras folder, map alias names back to real files via the exist_map.json in your models dir (that's the FELoraEmpFinder bit), filter with the regex, and random.sample. Two traps to know:
- It raises an error if you ask for more matches than exist.
countgreater than the number of regex matches →ValueError. So keepcountcomfortably below your expected pool, and test your regex. - The output is raw filenames, not a loaded stack. If you wire it straight into a standard single-LoRA loader, you'll get an error. Match it to a list-capable loader from this pack.
Install
From fexli-util-node-comfyui:
cd ComfyUI/custom_nodes
git clone https://github.com/fexli/fexli-util-node-comfyui
cd fexli-util-node-comfyui
pip install -r requirements.txt
Or Manager → search fexli-util-node-comfyui → install → restart. No model files; the only "data" it reads is your existing LoRA list.
Bottom line: it's a quiet little utility that turns "which style LoRA today?" into a seeded roll. Set a fixed seed when you find a combination you love; let it ride when you want surprises.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| regex | STRING | 背景|style | — |
| count | INT | 41–256 | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | * | — |