Instructions to use stabilityai/stable-diffusion-xl-base-1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use stabilityai/stable-diffusion-xl-base-1.0 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
Too slow while generating images for list of prompts
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