@@ -30,6 +30,7 @@ Note that the architecture is more or less identical to [Stable Diffusion 1](./a
3030- *Text-to-Image (768x768 resolution)*: [stabilityai/stable-diffusion-2](https://huggingface.co/stabilityai/stable-diffusion-2) with [`StableDiffusionPipeline`]
3131- *Image Inpainting (512x512 resolution)*: [stabilityai/stable-diffusion-2-inpainting](https://huggingface.co/stabilityai/stable-diffusion-2-inpainting) with [`StableDiffusionInpaintPipeline`]
3232- *Image Upscaling (x4 resolution resolution)*: [stable-diffusion-x4-upscaler](https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler) [`StableDiffusionUpscalePipeline`]
33+ - *Depth-to-Image (512x512 resolution)*: [stabilityai/stable-diffusion-2-depth](https://huggingface.co/stabilityai/stable-diffusion-2-depth) with [`StableDiffusionDepth2ImagePipeline`]
3334
3435We recommend using the [`DPMSolverMultistepScheduler`] as it's currently the fastest scheduler there is.
3536
@@ -125,6 +126,37 @@ upscaled_image = pipeline(prompt=prompt, image=low_res_img).images[0]
125126upscaled_image.save("upsampled_cat.png")
126127```
127128
129+ - *Depth-Guided Text-to-Image*: [stabilityai/stable-diffusion-2-depth](https://huggingface.co/stabilityai/stable-diffusion-2-depth) [`StableDiffusionDepth2ImagePipeline`]
130+
131+ **Installation**
132+
133+ ```bash
134+ !pip install -U git+https://github.com/huggingface/transformers.git
135+ !pip install diffusers[torch]
136+ ```
137+
138+ **Example**
139+
140+ ```python
141+ import torch
142+ import requests
143+ from PIL import Image
144+
145+ from diffusers import StableDiffusionDepth2ImgPipeline
146+
147+ pipe = StableDiffusionDepth2ImgPipeline.from_pretrained(
148+ " stabilityai/stable-diffusion-2-depth" ,
149+ torch_dtype =torch.float16,
150+ ).to("cuda")
151+
152+
153+ url = " http://images.cocodataset.org/val2017/000000039769.jpg"
154+ init_image = Image.open(requests.get(url, stream =True).raw)
155+ prompt = " two tigers"
156+ n_propmt = " bad, deformed, ugly, bad anotomy"
157+ image = pipe(prompt=prompt, image =init_image, negative_prompt =n_propmt, strength =0.7).images[0]
158+ ```
159+
128160### How to load and use different schedulers.
129161
130162The stable diffusion pipeline uses [`DDIMScheduler`] scheduler by default. But `diffusers` provides many other schedulers that can be used with the stable diffusion pipeline such as [`PNDMScheduler`], [`LMSDiscreteScheduler`], [`EulerDiscreteScheduler`], [`EulerAncestralDiscreteScheduler`] etc.
0 commit comments