TensorStack-AI / OnnxStack

C# Stable Diffusion using ONNX Runtime
Apache License 2.0
222 stars 33 forks source link

Image Batch Processing #23

Closed saddam213 closed 1 year ago

saddam213 commented 1 year ago

This PR is to introduce batch processing of images.

Some background, support for batch prompt processing was added, however this has some fallbacks IMO, as it stands now if you create a batch of 4 images, it will process the prompt etc once, however the expensive parts really gain no benefit, you just end up waiting 4x longer for 4 images, and you can only run a Batch on one set of Scheduler settings

I propose a solution to this and also provide more options for batch results.

Adding a new DiffuseBatchAsync method in the base diffusers that returns a collection of tensors, this method will take in a new BatchOptions parameter, this we can use to provide all the parameter for the batch type we want to run

Each image will be returned to the user as its generated, so no long wait, and can be canceled without losing the images already generated.