Instructions to use CompVis/stable-diffusion-v1-4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use CompVis/stable-diffusion-v1-4 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", dtype=torch.bfloat16, device_map="cuda") prompt = "A high tech solarpunk utopia in the Amazon rainforest" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
Error
/usr/local/lib/python3.7/dist-packages/diffusers/schedulers/scheduling_lms_discrete.py:199: UserWarning: The scale_model_input function should be called before step to ensure correct denoising. See StableDiffusionPipeline for a usage example.
"The scale_model_input function should be called before step to ensure correct denoising. "
TypeError Traceback (most recent call last)
in
57
58 # Display
---> 59 image = (image / 2 + 0.5).clamp(0, 1)
60 image = image.detach().cpu().permute(0, 2, 3, 1).numpy()
61 images = (image * 255).round().astype("uint8")
TypeError: unsupported operand type(s) for /: 'DecoderOutput' and 'int'
use image.sample instead of image.
I got the same error when I tried to run stable diffusion on Triton, following their example. Here is the github issue with details:
https://github.com/triton-inference-server/server/issues/5073