Too slow while generating images for list of prompts

#198
by shitlesh - opened

I am trying to use this model to generate images along with the text prompts which are also generating from text summarization (google-t5/t5-small) model, But for generating 20 images it takes around whole day long. Does anybody knows or encountered similar problem?

I have gone through the model and there's nothing mentioned that it'll take this much time to generate small set of images. If I am going wrong, please guide me to the correct solution for this. Below is the code snippet for reference:

def image_generation(text, pipeline):
''' Generate an image from the given text using the loaded model '''
with torch.inference_mode():
pipeline.scheduler = DPMSolverMultistepScheduler.from_config(pipeline.scheduler.config)
img = pipeline(text,
height=1024,
width=1024,
guidance_scale = 7.0,
num_inference_steps=70).images[0]

    return img

PS: This feature is for one of my private project and this code plug somewhere else to generate the whole solution

Sign up or log in to comment