🐟Load Prompts From Folder
Iterate a folder of prompt/caption files
- prompts
- images
- current_index
Between the prompts output and the images output sitting side by side, this node's purpose gives itself away: it's built for the classic captioned-dataset layout - img001.png next to img001.txt - the same pairing used for LoRA training sets. Point it at a folder and it walks through matched prompt/image pairs, which makes it a natural fit for batch-processing a dataset (re-captioning, running each pair through a check, feeding a training-prep pipeline) rather than one-off single-prompt generation.
Note this node isn't documented in the pack's README at all - it's not one of the nine nodes the author explicitly lists - so some of the behavior here is read from the schema and field names rather than confirmed by the author's own words. Worth double-checking the actual matching logic against your dataset before relying on it for something important.
How it works
Give it a folder and a file extension (.txt by default) for the prompt files, and it reads through matching prompt/image pairs, returning both as parallel lists. start_index and load_cap let you page through a large folder instead of loading everything at once, and loop_mode - when on - wraps back around to the start once you run past the end, which is useful if you're feeding this into an indefinitely-running batch job rather than a fixed one-shot run.
The inputs and outputs that matter
folder(STRING) - the dataset folder to read from.file_extension(STRING, default.txt) - which extension counts as a prompt file.loop_mode(BOOLEAN, default off) - wrap around to the beginning instead of stopping at the end of the folder.start_index(INT, 0–10000, default 0) andload_cap(INT, -1 to 100, default -1) - pagination. Unlike the pack'sLoadImageFromFolder,-1here means "no cap," so leaving it at the default loads everything found fromstart_indexonward.
Outputs: prompts (a list of STRING) and images (a list of IMAGE) - the matched pairs - plus current_index (INT), which tracks where the read cursor ended up, presumably useful for chaining into the next run of a loop.
How to install it
Search ComfyUI-QHNodes in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/liuqianhonga/ComfyUI-QHNodes.git
Restart. No submodules needed for this one - it behaves like a main-repo node in the schema, even though the README hasn't caught up to documenting it yet.
Common issues & troubleshooting
Prompts and images end up mismatched or one list is empty. Since this node's pairing logic isn't documented anywhere, the safest assumption is that it matches files by basename (same name, different extension) - if your dataset uses a different naming convention between prompt files and images, that pairing will break. Check that filenames actually line up before trusting the output order.
Folder has far more pairs than load_cap lets through. With the default -1, that's not the issue - but if you've set an explicit cap, remember it tops out at 100 per run; for a larger dataset you'll need to page through with start_index across multiple runs, or lean on loop_mode if the downstream part of your graph is designed to keep consuming indefinitely.
Empty prompt or image output with no error. If file_extension doesn't match what's actually in the folder (a stray capital .TXT, or captions saved as .caption instead of .txt), you'll likely just get nothing back rather than a loud failure - worth checking the extension is spelled exactly as it appears on disk.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| folder | STRING | — | |
| file_extension | STRING | .txt | — |
| loop_mode | BOOLEAN | false | — |
| start_index | INT | 00–10000 | — |
| load_cap | INT | -1-1–100 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| prompts | STRING | — |
| images | IMAGE | — |
| current_index | INT | — |