Help how do I cycle a list of files in a directory in batches?

Hi, I am trying to create a flow to bulk process image files in a directory both to improve them, and maybe also to get the files ready for LoRA processing. I have a working flow using Load Image List From Directory (inspire) which will pull in all the files which works for about 20 images…however I run out of VRAM beyond that. Ideally I want to process the images (which are different sizes so I don’t want to work in batches), in groups e.g. 15 images sent through the process at a time. This balances the constraints of my GPU/VRAM whilst gaining efficiency of not loading models for every image (e.g. the model only loads once per 15 files).

I cannot however find any videos, guides or workflows that explain how to get this to work with queues, loops etc? If you have any ideas I would be very grateful as this is my first push into ComfyUI!

Thanks for your help :slight_smile:

Jon

PS - link to my flow, I also made a few custom nodes which are also included.
Jons ComfyFlow.zip

Did you find a solution?
What I have done in the past for things like this is, save the workflow for API use, then call the API workflow from another script to basically batch it outside ComfyUI…
It does get tricky as you need to modify the workflow each time the batch runs to process the different data you want, you can do something simple like, find the line in the workflow that contains a skip value, and increment that for each run…