I have a usecase where I have to generate around 100 images for the same prompt but each image has to be generated from a different random seed. I was hoping to find a way to optimize the time taken to generate these 100 images.
Current approach:
num_images=100
gen_images=[]
model_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")
pipe.enable_xformers_memory_efficient_attention()
prompt = "a photo of an astronaut riding a horse on mars"
for i in range(num_images):
image = pipe(prompt).images[0]
gen_images.append(image)