Batch Processor
Chunk a big image folder before you throw it at a caption model
- image_paths
- batches
This one's simple, and that's the point. Image Loader hands you a flat list of every image path in a folder - could be twenty, could be two thousand. Feeding all of them into Caption Generator in one go means the captioning model has to chew through the whole pile at once, which is exactly how you end up watching VRAM climb and eventually run out on a big dataset or a heavier model. Batch Processor sits between the two and slices that flat list into smaller groups first.
How it works
It takes image_paths and a batch_size, and groups the paths into chunks of that size. Nothing more clever than that - no filtering, no reordering, just splitting one long list into several shorter ones so whatever consumes it downstream (Caption Generator's image_batches input) gets manageable pieces instead of the entire folder at once.
The inputs and outputs that matter
image_paths(LIST, required) - normally the direct output of Image Loader.batch_size(INT, default1, minimum1) - how many image paths go into each group. The default of1is the safest possible setting: every image processed on its own, no batching benefit, but also no risk of a batch being too big for your GPU. Raise it once you know your model and card can handle more than one image's worth of work at a time - there's no meaningful downside to trying4or8and watching what happens.
Output is batches (LIST) - feed it straight into Caption Generator's image_batches input.
Installing it
Through ComfyUI Manager: search ComfyUI-Transformers-Pipeline, install, restart. By hand:
cd ComfyUI/custom_nodes
git clone https://github.com/mediocreatmybest/ComfyUI-Transformers-Pipeline
then restart. No model downloads here - this node does no inference, it's pure list-splitting, so it's essentially free to run.
Common issues & troubleshooting
Nothing seems to change when I add this node. At the default batch_size of 1, you won't see a speed difference from batching - it's grouping the list into chunks of exactly one item each, which is functionally the same as no batching. Raise the value to actually get the benefit.
Ran out of memory after raising batch_size. Bring it back down. There's no auto-tuning here - this node will happily hand Caption Generator a batch too large for your setup if you set it that way. Step it up gradually (2, then 4, then 8) rather than guessing a big number, and pair it with Model Loader's use_bitsandbytes option if you're on a heavier model and still tight on VRAM.
Not sure what a sensible batch_size is. It depends entirely on which model you loaded in Model Loader and how much VRAM you have - a small BLIP-base model tolerates much bigger batches than a 6.7B BLIP2 variant. Start at 1, confirm the pipeline works end to end, then raise it and watch for the first OOM.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image_paths | LIST | — | |
| batch_size | INT | 1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| batches | LIST | — |