R
RunPod3w ago
Keev

ComfyUI Image quantity / batch size issue when sending request to serverless endpoint

I'm not able to generate multiple images from a prompt / request to the endpoint using a ComfyUI workflow. We have added a variable for the ""batch_size": " value in our workflow, but it only seems to generate one image regardless of the batch_size we give it. This is our Github repo for the runpod worker: https://github.com/sozanski1988/runpod-worker-comfyui/ And the workflow json is here: https://github.com/sozanski1988/runpod-worker-comfyui/blob/main/test_resources/workflows/default_workflow.json Is there a special way that we need to alter the workflow to be able to generate urls for multiple image outputs? P.S. I've also added an example request and serverless endpoint logs for reference.
11 Replies
nerdylive
nerdylive3w ago
Upload all of the results
Keev
KeevOP3w ago
Sorry, I'm unsure what you mean. Which results do you want me to upload?
nerdylive
nerdylive3w ago
The image results To s3, and then return the url Isn't it how it should be working? Does it return the specified amount inside the comfyui? Or it's because of the python handler for runpod serverless?
Keev
KeevOP3w ago
In the request logs it just seems to be outputting one image result, even when batch_size should be set to a higher quantity
Keev
KeevOP3w ago
Here's the code we are using to make request from our applications side, but also for demo requests in the Runpod request field when I set the batch_size to a higher number it always just outputs one image
nerdylive
nerdylive3w ago
I'm not sure this is relevanr, Im unable to run your comfyui setup, are you Able to debug the comfyui running inside your worker? Or run it locally to see if the work flow actually saves more than 1 image If yes, then it's an issue in your handler code, if not, then fix your work flow to save more than 1 files
Keev
KeevOP3w ago
Yes, the ComfyUI workflow works locally and is outputting multiple images
nerdylive
nerdylive3w ago
Okay. Check the handler code where it uploads the image results that are saved
Keev
KeevOP3w ago
This is the handler code: https://github.com/sozanski1988/runpod-worker-comfyui/blob/main/src/rp_handler.py When I send a request on Runpod it only seems to save the output of the last image generated: 2025-01-08T13:10:36.011632514Z Prompt executed in 15.89 seconds 2025-01-08T13:10:36.128850300Z runpod-worker-comfy - image generation is done 2025-01-08T13:10:36.128895408Z runpod-worker-comfy - /comfyui/output/ComfyUI00012.png 2025-01-08T13:10:36.133662502Z runpod-worker-comfy - the image was generated and converted to base64 2025-01-08T13:10:37.512337892Z {"requestId": "89b2d639-6fee-4aab-a1bc-6ea766b85cd9-e1", "message": "Finished.", "level": "INFO"} (I'm using the handler file you provided earlier btw, the "blib_la" one
Keev
KeevOP3w ago
(I set the batch size to 12 images here)
No description
Keev
KeevOP3w ago
We get the image output as a base64 encoded string (we didnt set up AWS as we use Firestore and we thinking to store the image file their after we've retrieved it from the Runpod worker)

Did you find this page helpful?