Filter Path List
An allowlist for a training set, written as JSON
- filtered_path_list
What it's for
This is a hand-picked-selection node, and it's honest about where it came from: the default category name is BestPeople, and the file convention it expects is Subject-0002.png. It was clearly born in someone's celebrity-face dataset pipeline, sorting thousands of scraped images into "the ones I've vetted" and "the rest".
That's still the useful shape for anyone curating a training set, which is the single highest-leverage thing you can do for a LoRA. If your dataset folder is a flat pile and you have opinions about 60 specific files inside it, this node turns your opinion into JSON and filters the file list without touching the disk.
How the filter JSON works
filter_json is a JSON object with categories at the top level, tags inside them, and an images list under each tag:
{
"BestPeople": {
"AnyaTaylorJoy": {
"images": ["0002", "0003", "0007"]
},
"JennaOrtega": {
"images": "all"
}
}
}
The category widget picks which top-level key to use - with the example above, BestPeople. For every path in the list, the node checks each tag under that category:
- The tag has to appear as a substring anywhere in the full path, so the folder name counts (
AnyaTaylorJoy/AnyaTaylorJoy-0002.jpgmatches on the folder alone). - Then it regex-matches
tag-<number>with a trailing word boundary, soAnyaTaylorJoy-0002matches andAnyaTaylorJoy-00020does not. - If
imagesis the string"all", the tag match alone is enough - the whole subject comes through.
A path is kept if any tag matches. It's a union, not an intersection, so adding tags only ever widens the result.
Both the tag test and the filename test are case-sensitive, and the tag test happens against the whole path - a folder named backup_AnyaTaylorJoy_moved would match the tag even if no file in it is in your list. Keep your directory names out of the way of your tags.
Inputs and outputs
path_list is a forced input - you wire it, you don't type it - and the natural source is Enumerate Files In Folder from the same pack. category and filter_json are both widgets. There's one output, filtered_path_list, again a list, so it fans out into whatever consumes a list downstream.
Installing it
Part of ComfyUI-TinyBee, 🐝TinyBee/Lists. Standard library only per the README; requirements.txt is pillow. No downloads.
cd ComfyUI/custom_nodes
git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
Or search ComfyUI-TinyBee in Manager, install, restart. The pack's List and Dict nodes came over from the author's older ComfyUI-Nid pack under the same node names - don't run both packs side by side.
Where people get burned
A category typo is silent and total. If BestPeople doesn't exactly match a top-level key, you don't get an error - you get an empty list, and whatever's downstream just doesn't run. Same if filter_json is empty or malformed-but-parseable-but-empty. When a batch quietly does nothing, print the list before blaming the sampler.
Malformed JSON does fail loudly, with the parser's message attached, which is the good case. The "all" shorthand needs to be the bare string - "images": all is invalid JSON and "images": ["all"] is a one-element list, which will not do what you meant.
And because the node is keyed on its inputs, editing filter_json is enough to make it re-run. It's the file system that won't invalidate it: Enumerate Files In Folder upstream has to be dirtied separately if files were added on disk.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| path_list | STRING | — | |
| category | STRING | BestPeople | — |
| filter_json | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| filtered_path_list | STRING | — |