Text Batch Loader
The caption loader that pairs with your image loader
- text_list
- filename_list
CCC_TextBatchLoader is the text half of the dataset-loading pair in this pack. Where CCC_ImageBatchLoader dumps a folder of images into the graph, this one dumps a folder of caption files - JSON, txt, whatever - as a list of strings, each tagged with its filename. If you've been captioning your LoRA training set outside ComfyUI and want to bring the captions in to review or re-process them, this is the on-ramp.
It sits in the Consistent Character Creator group, alongside the image loader and the interactive Dataset Reviewer. The reviewer expects captions on a STRING input; this node produces exactly that shape.
How it works
Dead simple, and that's the appeal. You give it:
folder_path- where your caption files live.extension- which files count. Defaults to.json, but it's just a string suffix check, so.txt,.safetensors-adjacent formats, whatever you use.max_files-0(default) means load everything. Set a number to cap it - handy when you're iterating on the first N captions.
Files are read sorted by name and returned in order. Both outputs are lists:
text_list- the raw file contents as strings.filename_list- the matching file names, so you can keep captions aligned with their images later.
The notable behavior difference from the image loader: it's forgiving. Point it at a folder that doesn't exist or has no matching files and it doesn't throw - it logs to the console and returns a single empty string. That's useful inside a big graph where you don't want one bad path killing the whole queue, but it also means you can silently get [""] and wonder why nothing's happening. If your reviewer shows one empty caption, check the console output for [DatasetCreation] Text Batch Loader: folder not found -> ....
Where it fits
The typical loop: images out of CCC_ImageBatchLoader, captions out of this, both into CCC_ShowImageTextPairs or CCC_DatasetReviewer so you can eyeball image-text pairs before training. Because the outputs are lists with matching indices, the pairing just works as long as your caption filenames sort in the same order as your images - which is exactly why the image loader sorts by name too.
One honest caveat: if your captions are already inline in JSON with your images, or you caption in ComfyUI itself, you may never need this node. It earns its keep when your captioning pipeline lives outside the graph.
Installing it
Part of the Mickmumpitz-Nodes pack. ComfyUI Manager → search "Mickmumpitz" → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/mickmumpitz/ComfyUI-Mickmumpitz-Nodes.git
Nothing extra to download - this pack's hard dependencies are just numpy, Pillow and opencv-python.
Troubleshooting
- Empty captions, no error - almost always the path or extension. Check the console line it prints.
- Wrong ordering - sorted by name, so zero-pad if you need numeric order (
cap_01.jsonbeforecap_02.json, notcap_10first). - UTF-8 captions failing - files are read as UTF-8; if your captions were saved in another encoding, they'll throw per-file and get skipped (logged, not fatal).
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | C:\path\to\your\captions | — |
| extension | STRING | .json | — |
| max_files | INT | 00–9999 | 0 = load ALL files |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| text_list | STRING | — |
| filename_list | STRING | — |