Text-to-Image
Diffusion Single File
English
stable-diffusion

How to generate multiple images at once

#99
by zhengjx - opened

when i added The parameter "num_images_per_prompt" reported an error,

RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 2 but got size 1 for tensor number 1 in the list.

image = pipe(
prompt = prompt,
negative_prompt = negative_prompt,
guidance_scale = guidance_scale,
num_images_per_prompt = 2,
num_inference_steps = num_inference_steps,
width = width,
height = height,
generator = generator
).images

You can do e.g. [prompt]*2, likewise for prompt2, negative_prompt, and not use the num_images_per_prompt parameter.

Hello How do i get multiple images in 1 prompt.. I need atleast 3 right now i was trying with hugging face inference sdk with textToImage and i dont see any options to pass number of images and it always returns 1

Sign up or log in to comment