import{S as ul,i as hl,s as cl,e as l,k as u,w as _,t as i,M as dl,c as r,d as s,m as h,a as o,x as b,h as a,b as n,G as t,g as f,y as v,L as ml,q as w,o as y,B as S,v as gl}from"../../../chunks/vendor-hf-doc-builder.js";import{I as ts}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{C as me}from"../../../chunks/CodeBlock-hf-doc-builder.js";function _l(Xi){let j,Et,P,C,Je,z,ss,Xe,is,Dt,m,as,Ze,ls,rs,V,os,ns,Y,ps,fs,Q,us,hs,It,ge,$,cs,W,ds,ms,K,gs,_s,jt,B,bs,J,vs,ws,Pt,q,H,et,X,ys,tt,Ss,$t,k,R,st,Z,Es,it,Ds,qt,E,Is,_e,js,Ps,be,$s,qs,kt,g,x,at,ks,xs,ee,As,Ms,ve,Ls,Ts,A,lt,Ns,Os,te,Us,Cs,we,Bs,Hs,M,rt,Rs,Fs,se,Gs,zs,ye,Vs,Ys,L,ot,Qs,Ws,ie,Ks,Js,Se,Xs,Zs,T,nt,ei,ti,ae,si,ii,pt,ai,xt,F,li,Ee,ri,oi,At,De,Ie,ft,ni,pi,Mt,le,Lt,je,Pe,ut,fi,ui,Tt,re,Nt,$e,qe,ht,hi,ci,Ot,oe,Ut,ke,N,ct,di,mi,ne,gi,_i,xe,bi,Ct,pe,Bt,Ae,O,dt,vi,wi,fe,yi,Si,mt,Ei,Ht,Me,gt,Di,Rt,ue,Ft,Le,_t,Ii,Gt,he,zt,U,G,bt,ce,ji,vt,Pi,Vt,c,$i,Te,qi,ki,wt,xi,Ai,Ne,Mi,Li,Oe,Ti,Ni,Ue,Oi,Ui,Ce,Ci,Bi,Be,Hi,Ri,yt,Fi,Gi,St,zi,Vi,He,Yi,Qi,Yt,de,Qt;return z=new ts({}),X=new ts({}),Z=new ts({}),le=new me({props:{code:`from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
import torch

repo_id = "stabilityai/stable-diffusion-2-base"
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, revision="fp16")

pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to("cuda")

prompt = "High quality photo of an astronaut riding a horse in space"
image = pipe(prompt, num_inference_steps=25).images[0]
image.save("astronaut.png")`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline, DPMSolverMultistepScheduler
<span class="hljs-keyword">import</span> torch

repo_id = <span class="hljs-string">&quot;stabilityai/stable-diffusion-2-base&quot;</span>
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, revision=<span class="hljs-string">&quot;fp16&quot;</span>)

pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;High quality photo of an astronaut riding a horse in space&quot;</span>
image = pipe(prompt, num_inference_steps=<span class="hljs-number">25</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;astronaut.png&quot;</span>)`}}),re=new me({props:{code:`from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
import torch

repo_id = "stabilityai/stable-diffusion-2"
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, revision="fp16")

pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to("cuda")

prompt = "High quality photo of an astronaut riding a horse in space"
image = pipe(prompt, guidance_scale=9, num_inference_steps=25).images[0]
image.save("astronaut.png")`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline, DPMSolverMultistepScheduler
<span class="hljs-keyword">import</span> torch

repo_id = <span class="hljs-string">&quot;stabilityai/stable-diffusion-2&quot;</span>
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, revision=<span class="hljs-string">&quot;fp16&quot;</span>)

pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;High quality photo of an astronaut riding a horse in space&quot;</span>
image = pipe(prompt, guidance_scale=<span class="hljs-number">9</span>, num_inference_steps=<span class="hljs-number">25</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;astronaut.png&quot;</span>)`}}),oe=new me({props:{code:`import PIL
import requests
import torch
from io import BytesIO

from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler


def download_image(url):
    response = requests.get(url)
    return PIL.Image.open(BytesIO(response.content)).convert("RGB")


img_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
mask_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png"

init_image = download_image(img_url).resize((512, 512))
mask_image = download_image(mask_url).resize((512, 512))

repo_id = "stabilityai/stable-diffusion-2-inpainting"
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, revision="fp16")

pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to("cuda")

prompt = "Face of a yellow cat, high resolution, sitting on a park bench"
image = pipe(prompt=prompt, image=init_image, mask_image=mask_image, num_inference_steps=25).images[0]

image.save("yellow_cat.png")`,highlighted:`<span class="hljs-keyword">import</span> PIL
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline, DPMSolverMultistepScheduler


<span class="hljs-keyword">def</span> <span class="hljs-title function_">download_image</span>(<span class="hljs-params">url</span>):
    response = requests.get(url)
    <span class="hljs-keyword">return</span> PIL.Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)


img_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png&quot;</span>
mask_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png&quot;</span>

init_image = download_image(img_url).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))
mask_image = download_image(mask_url).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))

repo_id = <span class="hljs-string">&quot;stabilityai/stable-diffusion-2-inpainting&quot;</span>
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, revision=<span class="hljs-string">&quot;fp16&quot;</span>)

pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;Face of a yellow cat, high resolution, sitting on a park bench&quot;</span>
image = pipe(prompt=prompt, image=init_image, mask_image=mask_image, num_inference_steps=<span class="hljs-number">25</span>).images[<span class="hljs-number">0</span>]

image.save(<span class="hljs-string">&quot;yellow_cat.png&quot;</span>)`}}),pe=new me({props:{code:`import requests
from PIL import Image
from io import BytesIO
from diffusers import StableDiffusionUpscalePipeline
import torch

# load model and scheduler
model_id = "stabilityai/stable-diffusion-x4-upscaler"
pipeline = StableDiffusionUpscalePipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipeline = pipeline.to("cuda")

# let's download an  image
url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd2-upscale/low_res_cat.png"
response = requests.get(url)
low_res_img = Image.open(BytesIO(response.content)).convert("RGB")
low_res_img = low_res_img.resize((128, 128))
prompt = "a white cat"
upscaled_image = pipeline(prompt=prompt, image=low_res_img).images[0]
upscaled_image.save("upsampled_cat.png")`,highlighted:`<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionUpscalePipeline
<span class="hljs-keyword">import</span> torch

<span class="hljs-comment"># load model and scheduler</span>
model_id = <span class="hljs-string">&quot;stabilityai/stable-diffusion-x4-upscaler&quot;</span>
pipeline = StableDiffusionUpscalePipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipeline = pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-comment"># let&#x27;s download an  image</span>
url = <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd2-upscale/low_res_cat.png&quot;</span>
response = requests.get(url)
low_res_img = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
low_res_img = low_res_img.resize((<span class="hljs-number">128</span>, <span class="hljs-number">128</span>))
prompt = <span class="hljs-string">&quot;a white cat&quot;</span>
upscaled_image = pipeline(prompt=prompt, image=low_res_img).images[<span class="hljs-number">0</span>]
upscaled_image.save(<span class="hljs-string">&quot;upsampled_cat.png&quot;</span>)`}}),ue=new me({props:{code:`!pip install -U git+https://github.com/huggingface/transformers.git
!pip install diffusers[torch]`,highlighted:`!pip install -U git+https://github.com/huggingface/transformers.git
!pip install diffusers[torch]`}}),he=new me({props:{code:`import torch
import requests
from PIL import Image

from diffusers import StableDiffusionDepth2ImgPipeline

pipe = StableDiffusionDepth2ImgPipeline.from_pretrained(
    "stabilityai/stable-diffusion-2-depth",
    torch_dtype=torch.float16,
).to("cuda")


url = "http://images.cocodataset.org/val2017/000000039769.jpg"
init_image = Image.open(requests.get(url, stream=True).raw)
prompt = "two tigers"
n_propmt = "bad, deformed, ugly, bad anotomy"
image = pipe(prompt=prompt, image=init_image, negative_prompt=n_propmt, strength=0.7).images[0]`,highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionDepth2ImgPipeline

pipe = StableDiffusionDepth2ImgPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-2-depth&quot;</span>,
    torch_dtype=torch.float16,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)


url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
init_image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)
prompt = <span class="hljs-string">&quot;two tigers&quot;</span>
n_propmt = <span class="hljs-string">&quot;bad, deformed, ugly, bad anotomy&quot;</span>
image = pipe(prompt=prompt, image=init_image, negative_prompt=n_propmt, strength=<span class="hljs-number">0.7</span>).images[<span class="hljs-number">0</span>]`}}),ce=new ts({}),de=new me({props:{code:`from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler

pipeline = StableDiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2")
pipeline.scheduler = EulerDiscreteScheduler.from_config(pipeline.scheduler.config)

# or
euler_scheduler = EulerDiscreteScheduler.from_pretrained("stabilityai/stable-diffusion-2", subfolder="scheduler")
pipeline = StableDiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2", scheduler=euler_scheduler)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline, EulerDiscreteScheduler

<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = StableDiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;stabilityai/stable-diffusion-2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline.scheduler = EulerDiscreteScheduler.from_config(pipeline.scheduler.config)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># or</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>euler_scheduler = EulerDiscreteScheduler.from_pretrained(<span class="hljs-string">&quot;stabilityai/stable-diffusion-2&quot;</span>, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = StableDiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;stabilityai/stable-diffusion-2&quot;</span>, scheduler=euler_scheduler)`}}),{c(){j=l("meta"),Et=u(),P=l("h1"),C=l("a"),Je=l("span"),_(z.$$.fragment),ss=u(),Xe=l("span"),is=i("Stable diffusion 2"),Dt=u(),m=l("p"),as=i("Stable Diffusion 2 is a text-to-image "),Ze=l("em"),ls=i("latent diffusion"),rs=i(" model built upon the work of "),V=l("a"),os=i("Stable Diffusion 1"),ns=i(`.
The project to train Stable Diffusion 2 was led by Robin Rombach and Katherine Crowson from `),Y=l("a"),ps=i("Stability AI"),fs=i(" and "),Q=l("a"),us=i("LAION"),hs=i("."),It=u(),ge=l("p"),$=l("em"),cs=i(`The Stable Diffusion 2.0 release includes robust text-to-image models trained using a brand new text encoder (OpenCLIP), developed by LAION with support from Stability AI, which greatly improves the quality of the generated images compared to earlier V1 releases. The text-to-image models in this release can generate images with default resolutions of both 512x512 pixels and 768x768 pixels.
These models are trained on an aesthetic subset of the `),W=l("a"),ds=i("LAION-5B dataset"),ms=i(" created by the DeepFloyd team at Stability AI, which is then further filtered to remove adult content using "),K=l("a"),gs=i("LAION\u2019s NSFW filter"),_s=i("."),jt=u(),B=l("p"),bs=i("For more details about how Stable Diffusion 2 works and how it differs from Stable Diffusion 1, please refer to the official "),J=l("a"),vs=i("launch announcement post"),ws=i("."),Pt=u(),q=l("h2"),H=l("a"),et=l("span"),_(X.$$.fragment),ys=u(),tt=l("span"),Ss=i("Tips"),$t=u(),k=l("h3"),R=l("a"),st=l("span"),_(Z.$$.fragment),Es=u(),it=l("span"),Ds=i("Available checkpoints:"),qt=u(),E=l("p"),Is=i("Note that the architecture is more or less identical to "),_e=l("a"),js=i("Stable Diffusion 1"),Ps=i(" so please refer to "),be=l("a"),$s=i("this page"),qs=i(" for API documentation."),kt=u(),g=l("ul"),x=l("li"),at=l("em"),ks=i("Text-to-Image (512x512 resolution)"),xs=i(": "),ee=l("a"),As=i("stabilityai/stable-diffusion-2-base"),Ms=i(" with "),ve=l("a"),Ls=i("StableDiffusionPipeline"),Ts=u(),A=l("li"),lt=l("em"),Ns=i("Text-to-Image (768x768 resolution)"),Os=i(": "),te=l("a"),Us=i("stabilityai/stable-diffusion-2"),Cs=i(" with "),we=l("a"),Bs=i("StableDiffusionPipeline"),Hs=u(),M=l("li"),rt=l("em"),Rs=i("Image Inpainting (512x512 resolution)"),Fs=i(": "),se=l("a"),Gs=i("stabilityai/stable-diffusion-2-inpainting"),zs=i(" with "),ye=l("a"),Vs=i("StableDiffusionInpaintPipeline"),Ys=u(),L=l("li"),ot=l("em"),Qs=i("Image Upscaling (x4 resolution resolution)"),Ws=i(": "),ie=l("a"),Ks=i("stable-diffusion-x4-upscaler"),Js=u(),Se=l("a"),Xs=i("StableDiffusionUpscalePipeline"),Zs=u(),T=l("li"),nt=l("em"),ei=i("Depth-to-Image (512x512 resolution)"),ti=i(": "),ae=l("a"),si=i("stabilityai/stable-diffusion-2-depth"),ii=i(" with "),pt=l("code"),ai=i("StableDiffusionDepth2ImagePipeline"),xt=u(),F=l("p"),li=i("We recommend using the "),Ee=l("a"),ri=i("DPMSolverMultistepScheduler"),oi=i(" as it\u2019s currently the fastest scheduler there is."),At=u(),De=l("ul"),Ie=l("li"),ft=l("em"),ni=i("Text-to-Image (512x512 resolution)"),pi=i(":"),Mt=u(),_(le.$$.fragment),Lt=u(),je=l("ul"),Pe=l("li"),ut=l("em"),fi=i("Text-to-Image (768x768 resolution)"),ui=i(":"),Tt=u(),_(re.$$.fragment),Nt=u(),$e=l("ul"),qe=l("li"),ht=l("em"),hi=i("Image Inpainting (512x512 resolution)"),ci=i(":"),Ot=u(),_(oe.$$.fragment),Ut=u(),ke=l("ul"),N=l("li"),ct=l("em"),di=i("Image Upscaling (x4 resolution resolution)"),mi=i(": "),ne=l("a"),gi=i("stable-diffusion-x4-upscaler"),_i=u(),xe=l("a"),bi=i("StableDiffusionUpscalePipeline"),Ct=u(),_(pe.$$.fragment),Bt=u(),Ae=l("ul"),O=l("li"),dt=l("em"),vi=i("Depth-Guided Text-to-Image"),wi=i(": "),fe=l("a"),yi=i("stabilityai/stable-diffusion-2-depth"),Si=u(),mt=l("code"),Ei=i("StableDiffusionDepth2ImagePipeline"),Ht=u(),Me=l("p"),gt=l("strong"),Di=i("Installation"),Rt=u(),_(ue.$$.fragment),Ft=u(),Le=l("p"),_t=l("strong"),Ii=i("Example"),Gt=u(),_(he.$$.fragment),zt=u(),U=l("h3"),G=l("a"),bt=l("span"),_(ce.$$.fragment),ji=u(),vt=l("span"),Pi=i("How to load and use different schedulers."),Vt=u(),c=l("p"),$i=i("The stable diffusion pipeline uses "),Te=l("a"),qi=i("DDIMScheduler"),ki=i(" scheduler by default. But "),wt=l("code"),xi=i("diffusers"),Ai=i(" provides many other schedulers that can be used with the stable diffusion pipeline such as "),Ne=l("a"),Mi=i("PNDMScheduler"),Li=i(", "),Oe=l("a"),Ti=i("LMSDiscreteScheduler"),Ni=i(", "),Ue=l("a"),Oi=i("EulerDiscreteScheduler"),Ui=i(", "),Ce=l("a"),Ci=i("EulerAncestralDiscreteScheduler"),Bi=i(` etc.
To use a different scheduler, you can either change it via the `),Be=l("a"),Hi=i("ConfigMixin.from_config()"),Ri=i(" method or pass the "),yt=l("code"),Fi=i("scheduler"),Gi=i(" argument to the "),St=l("code"),zi=i("from_pretrained"),Vi=i(" method of the pipeline. For example, to use the "),He=l("a"),Yi=i("EulerDiscreteScheduler"),Qi=i(", you can do the following:"),Yt=u(),_(de.$$.fragment),this.h()},l(e){const p=dl('[data-svelte="svelte-1phssyn"]',document.head);j=r(p,"META",{name:!0,content:!0}),p.forEach(s),Et=h(e),P=r(e,"H1",{class:!0});var Wt=o(P);C=r(Wt,"A",{id:!0,class:!0,href:!0});var Zi=o(C);Je=r(Zi,"SPAN",{});var ea=o(Je);b(z.$$.fragment,ea),ea.forEach(s),Zi.forEach(s),ss=h(Wt),Xe=r(Wt,"SPAN",{});var ta=o(Xe);is=a(ta,"Stable diffusion 2"),ta.forEach(s),Wt.forEach(s),Dt=h(e),m=r(e,"P",{});var D=o(m);as=a(D,"Stable Diffusion 2 is a text-to-image "),Ze=r(D,"EM",{});var sa=o(Ze);ls=a(sa,"latent diffusion"),sa.forEach(s),rs=a(D," model built upon the work of "),V=r(D,"A",{href:!0,rel:!0});var ia=o(V);os=a(ia,"Stable Diffusion 1"),ia.forEach(s),ns=a(D,`.
The project to train Stable Diffusion 2 was led by Robin Rombach and Katherine Crowson from `),Y=r(D,"A",{href:!0,rel:!0});var aa=o(Y);ps=a(aa,"Stability AI"),aa.forEach(s),fs=a(D," and "),Q=r(D,"A",{href:!0,rel:!0});var la=o(Q);us=a(la,"LAION"),la.forEach(s),hs=a(D,"."),D.forEach(s),It=h(e),ge=r(e,"P",{});var ra=o(ge);$=r(ra,"EM",{});var Re=o($);cs=a(Re,`The Stable Diffusion 2.0 release includes robust text-to-image models trained using a brand new text encoder (OpenCLIP), developed by LAION with support from Stability AI, which greatly improves the quality of the generated images compared to earlier V1 releases. The text-to-image models in this release can generate images with default resolutions of both 512x512 pixels and 768x768 pixels.
These models are trained on an aesthetic subset of the `),W=r(Re,"A",{href:!0,rel:!0});var oa=o(W);ds=a(oa,"LAION-5B dataset"),oa.forEach(s),ms=a(Re," created by the DeepFloyd team at Stability AI, which is then further filtered to remove adult content using "),K=r(Re,"A",{href:!0,rel:!0});var na=o(K);gs=a(na,"LAION\u2019s NSFW filter"),na.forEach(s),_s=a(Re,"."),Re.forEach(s),ra.forEach(s),jt=h(e),B=r(e,"P",{});var Kt=o(B);bs=a(Kt,"For more details about how Stable Diffusion 2 works and how it differs from Stable Diffusion 1, please refer to the official "),J=r(Kt,"A",{href:!0,rel:!0});var pa=o(J);vs=a(pa,"launch announcement post"),pa.forEach(s),ws=a(Kt,"."),Kt.forEach(s),Pt=h(e),q=r(e,"H2",{class:!0});var Jt=o(q);H=r(Jt,"A",{id:!0,class:!0,href:!0});var fa=o(H);et=r(fa,"SPAN",{});var ua=o(et);b(X.$$.fragment,ua),ua.forEach(s),fa.forEach(s),ys=h(Jt),tt=r(Jt,"SPAN",{});var ha=o(tt);Ss=a(ha,"Tips"),ha.forEach(s),Jt.forEach(s),$t=h(e),k=r(e,"H3",{class:!0});var Xt=o(k);R=r(Xt,"A",{id:!0,class:!0,href:!0});var ca=o(R);st=r(ca,"SPAN",{});var da=o(st);b(Z.$$.fragment,da),da.forEach(s),ca.forEach(s),Es=h(Xt),it=r(Xt,"SPAN",{});var ma=o(it);Ds=a(ma,"Available checkpoints:"),ma.forEach(s),Xt.forEach(s),qt=h(e),E=r(e,"P",{});var Fe=o(E);Is=a(Fe,"Note that the architecture is more or less identical to "),_e=r(Fe,"A",{href:!0});var ga=o(_e);js=a(ga,"Stable Diffusion 1"),ga.forEach(s),Ps=a(Fe," so please refer to "),be=r(Fe,"A",{href:!0});var _a=o(be);$s=a(_a,"this page"),_a.forEach(s),qs=a(Fe," for API documentation."),Fe.forEach(s),kt=h(e),g=r(e,"UL",{});var I=o(g);x=r(I,"LI",{});var Ge=o(x);at=r(Ge,"EM",{});var ba=o(at);ks=a(ba,"Text-to-Image (512x512 resolution)"),ba.forEach(s),xs=a(Ge,": "),ee=r(Ge,"A",{href:!0,rel:!0});var va=o(ee);As=a(va,"stabilityai/stable-diffusion-2-base"),va.forEach(s),Ms=a(Ge," with "),ve=r(Ge,"A",{href:!0});var wa=o(ve);Ls=a(wa,"StableDiffusionPipeline"),wa.forEach(s),Ge.forEach(s),Ts=h(I),A=r(I,"LI",{});var ze=o(A);lt=r(ze,"EM",{});var ya=o(lt);Ns=a(ya,"Text-to-Image (768x768 resolution)"),ya.forEach(s),Os=a(ze,": "),te=r(ze,"A",{href:!0,rel:!0});var Sa=o(te);Us=a(Sa,"stabilityai/stable-diffusion-2"),Sa.forEach(s),Cs=a(ze," with "),we=r(ze,"A",{href:!0});var Ea=o(we);Bs=a(Ea,"StableDiffusionPipeline"),Ea.forEach(s),ze.forEach(s),Hs=h(I),M=r(I,"LI",{});var Ve=o(M);rt=r(Ve,"EM",{});var Da=o(rt);Rs=a(Da,"Image Inpainting (512x512 resolution)"),Da.forEach(s),Fs=a(Ve,": "),se=r(Ve,"A",{href:!0,rel:!0});var Ia=o(se);Gs=a(Ia,"stabilityai/stable-diffusion-2-inpainting"),Ia.forEach(s),zs=a(Ve," with "),ye=r(Ve,"A",{href:!0});var ja=o(ye);Vs=a(ja,"StableDiffusionInpaintPipeline"),ja.forEach(s),Ve.forEach(s),Ys=h(I),L=r(I,"LI",{});var Ye=o(L);ot=r(Ye,"EM",{});var Pa=o(ot);Qs=a(Pa,"Image Upscaling (x4 resolution resolution)"),Pa.forEach(s),Ws=a(Ye,": "),ie=r(Ye,"A",{href:!0,rel:!0});var $a=o(ie);Ks=a($a,"stable-diffusion-x4-upscaler"),$a.forEach(s),Js=h(Ye),Se=r(Ye,"A",{href:!0});var qa=o(Se);Xs=a(qa,"StableDiffusionUpscalePipeline"),qa.forEach(s),Ye.forEach(s),Zs=h(I),T=r(I,"LI",{});var Qe=o(T);nt=r(Qe,"EM",{});var ka=o(nt);ei=a(ka,"Depth-to-Image (512x512 resolution)"),ka.forEach(s),ti=a(Qe,": "),ae=r(Qe,"A",{href:!0,rel:!0});var xa=o(ae);si=a(xa,"stabilityai/stable-diffusion-2-depth"),xa.forEach(s),ii=a(Qe," with "),pt=r(Qe,"CODE",{});var Aa=o(pt);ai=a(Aa,"StableDiffusionDepth2ImagePipeline"),Aa.forEach(s),Qe.forEach(s),I.forEach(s),xt=h(e),F=r(e,"P",{});var Zt=o(F);li=a(Zt,"We recommend using the "),Ee=r(Zt,"A",{href:!0});var Ma=o(Ee);ri=a(Ma,"DPMSolverMultistepScheduler"),Ma.forEach(s),oi=a(Zt," as it\u2019s currently the fastest scheduler there is."),Zt.forEach(s),At=h(e),De=r(e,"UL",{});var La=o(De);Ie=r(La,"LI",{});var Wi=o(Ie);ft=r(Wi,"EM",{});var Ta=o(ft);ni=a(Ta,"Text-to-Image (512x512 resolution)"),Ta.forEach(s),pi=a(Wi,":"),Wi.forEach(s),La.forEach(s),Mt=h(e),b(le.$$.fragment,e),Lt=h(e),je=r(e,"UL",{});var Na=o(je);Pe=r(Na,"LI",{});var Ki=o(Pe);ut=r(Ki,"EM",{});var Oa=o(ut);fi=a(Oa,"Text-to-Image (768x768 resolution)"),Oa.forEach(s),ui=a(Ki,":"),Ki.forEach(s),Na.forEach(s),Tt=h(e),b(re.$$.fragment,e),Nt=h(e),$e=r(e,"UL",{});var Ua=o($e);qe=r(Ua,"LI",{});var Ji=o(qe);ht=r(Ji,"EM",{});var Ca=o(ht);hi=a(Ca,"Image Inpainting (512x512 resolution)"),Ca.forEach(s),ci=a(Ji,":"),Ji.forEach(s),Ua.forEach(s),Ot=h(e),b(oe.$$.fragment,e),Ut=h(e),ke=r(e,"UL",{});var Ba=o(ke);N=r(Ba,"LI",{});var We=o(N);ct=r(We,"EM",{});var Ha=o(ct);di=a(Ha,"Image Upscaling (x4 resolution resolution)"),Ha.forEach(s),mi=a(We,": "),ne=r(We,"A",{href:!0,rel:!0});var Ra=o(ne);gi=a(Ra,"stable-diffusion-x4-upscaler"),Ra.forEach(s),_i=h(We),xe=r(We,"A",{href:!0});var Fa=o(xe);bi=a(Fa,"StableDiffusionUpscalePipeline"),Fa.forEach(s),We.forEach(s),Ba.forEach(s),Ct=h(e),b(pe.$$.fragment,e),Bt=h(e),Ae=r(e,"UL",{});var Ga=o(Ae);O=r(Ga,"LI",{});var Ke=o(O);dt=r(Ke,"EM",{});var za=o(dt);vi=a(za,"Depth-Guided Text-to-Image"),za.forEach(s),wi=a(Ke,": "),fe=r(Ke,"A",{href:!0,rel:!0});var Va=o(fe);yi=a(Va,"stabilityai/stable-diffusion-2-depth"),Va.forEach(s),Si=h(Ke),mt=r(Ke,"CODE",{});var Ya=o(mt);Ei=a(Ya,"StableDiffusionDepth2ImagePipeline"),Ya.forEach(s),Ke.forEach(s),Ga.forEach(s),Ht=h(e),Me=r(e,"P",{});var Qa=o(Me);gt=r(Qa,"STRONG",{});var Wa=o(gt);Di=a(Wa,"Installation"),Wa.forEach(s),Qa.forEach(s),Rt=h(e),b(ue.$$.fragment,e),Ft=h(e),Le=r(e,"P",{});var Ka=o(Le);_t=r(Ka,"STRONG",{});var Ja=o(_t);Ii=a(Ja,"Example"),Ja.forEach(s),Ka.forEach(s),Gt=h(e),b(he.$$.fragment,e),zt=h(e),U=r(e,"H3",{class:!0});var es=o(U);G=r(es,"A",{id:!0,class:!0,href:!0});var Xa=o(G);bt=r(Xa,"SPAN",{});var Za=o(bt);b(ce.$$.fragment,Za),Za.forEach(s),Xa.forEach(s),ji=h(es),vt=r(es,"SPAN",{});var el=o(vt);Pi=a(el,"How to load and use different schedulers."),el.forEach(s),es.forEach(s),Vt=h(e),c=r(e,"P",{});var d=o(c);$i=a(d,"The stable diffusion pipeline uses "),Te=r(d,"A",{href:!0});var tl=o(Te);qi=a(tl,"DDIMScheduler"),tl.forEach(s),ki=a(d," scheduler by default. But "),wt=r(d,"CODE",{});var sl=o(wt);xi=a(sl,"diffusers"),sl.forEach(s),Ai=a(d," provides many other schedulers that can be used with the stable diffusion pipeline such as "),Ne=r(d,"A",{href:!0});var il=o(Ne);Mi=a(il,"PNDMScheduler"),il.forEach(s),Li=a(d,", "),Oe=r(d,"A",{href:!0});var al=o(Oe);Ti=a(al,"LMSDiscreteScheduler"),al.forEach(s),Ni=a(d,", "),Ue=r(d,"A",{href:!0});var ll=o(Ue);Oi=a(ll,"EulerDiscreteScheduler"),ll.forEach(s),Ui=a(d,", "),Ce=r(d,"A",{href:!0});var rl=o(Ce);Ci=a(rl,"EulerAncestralDiscreteScheduler"),rl.forEach(s),Bi=a(d,` etc.
To use a different scheduler, you can either change it via the `),Be=r(d,"A",{href:!0});var ol=o(Be);Hi=a(ol,"ConfigMixin.from_config()"),ol.forEach(s),Ri=a(d," method or pass the "),yt=r(d,"CODE",{});var nl=o(yt);Fi=a(nl,"scheduler"),nl.forEach(s),Gi=a(d," argument to the "),St=r(d,"CODE",{});var pl=o(St);zi=a(pl,"from_pretrained"),pl.forEach(s),Vi=a(d," method of the pipeline. For example, to use the "),He=r(d,"A",{href:!0});var fl=o(He);Yi=a(fl,"EulerDiscreteScheduler"),fl.forEach(s),Qi=a(d,", you can do the following:"),d.forEach(s),Yt=h(e),b(de.$$.fragment,e),this.h()},h(){n(j,"name","hf:doc:metadata"),n(j,"content",JSON.stringify(bl)),n(C,"id","stable-diffusion-2"),n(C,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),n(C,"href","#stable-diffusion-2"),n(P,"class","relative group"),n(V,"href","https://stability.ai/blog/stable-diffusion-public-release"),n(V,"rel","nofollow"),n(Y,"href","https://stability.ai/"),n(Y,"rel","nofollow"),n(Q,"href","https://laion.ai/"),n(Q,"rel","nofollow"),n(W,"href","https://laion.ai/blog/laion-5b/"),n(W,"rel","nofollow"),n(K,"href","https://openreview.net/forum?id=M3Y74vmsMcY"),n(K,"rel","nofollow"),n(J,"href","https://stability.ai/blog/stable-diffusion-v2-release"),n(J,"rel","nofollow"),n(H,"id","tips"),n(H,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),n(H,"href","#tips"),n(q,"class","relative group"),n(R,"id","available-checkpoints"),n(R,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),n(R,"href","#available-checkpoints"),n(k,"class","relative group"),n(_e,"href","./api/pipelines/stable_diffusion"),n(be,"href","./api/pipelines/stable_diffusion"),n(ee,"href","https://huggingface.co/stabilityai/stable-diffusion-2-base"),n(ee,"rel","nofollow"),n(ve,"href","/docs/diffusers/v0.11.0/en/api/pipelines/stable_diffusion#diffusers.StableDiffusionPipeline"),n(te,"href","https://huggingface.co/stabilityai/stable-diffusion-2"),n(te,"rel","nofollow"),n(we,"href","/docs/diffusers/v0.11.0/en/api/pipelines/stable_diffusion#diffusers.StableDiffusionPipeline"),n(se,"href","https://huggingface.co/stabilityai/stable-diffusion-2-inpainting"),n(se,"rel","nofollow"),n(ye,"href","/docs/diffusers/v0.11.0/en/api/pipelines/stable_diffusion#diffusers.StableDiffusionInpaintPipeline"),n(ie,"href","https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler"),n(ie,"rel","nofollow"),n(Se,"href","/docs/diffusers/v0.11.0/en/api/pipelines/stable_diffusion#diffusers.StableDiffusionUpscalePipeline"),n(ae,"href","https://huggingface.co/stabilityai/stable-diffusion-2-depth"),n(ae,"rel","nofollow"),n(Ee,"href","/docs/diffusers/v0.11.0/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler"),n(ne,"href","https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler"),n(ne,"rel","nofollow"),n(xe,"href","/docs/diffusers/v0.11.0/en/api/pipelines/stable_diffusion#diffusers.StableDiffusionUpscalePipeline"),n(fe,"href","https://huggingface.co/stabilityai/stable-diffusion-2-depth"),n(fe,"rel","nofollow"),n(G,"id","how-to-load-and-use-different-schedulers"),n(G,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),n(G,"href","#how-to-load-and-use-different-schedulers"),n(U,"class","relative group"),n(Te,"href","/docs/diffusers/v0.11.0/en/api/schedulers/ddim#diffusers.DDIMScheduler"),n(Ne,"href","/docs/diffusers/v0.11.0/en/api/schedulers/pndm#diffusers.PNDMScheduler"),n(Oe,"href","/docs/diffusers/v0.11.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler"),n(Ue,"href","/docs/diffusers/v0.11.0/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler"),n(Ce,"href","/docs/diffusers/v0.11.0/en/api/schedulers/euler_ancestral#diffusers.EulerAncestralDiscreteScheduler"),n(Be,"href","/docs/diffusers/v0.11.0/en/api/configuration#diffusers.ConfigMixin.from_config"),n(He,"href","/docs/diffusers/v0.11.0/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler")},m(e,p){t(document.head,j),f(e,Et,p),f(e,P,p),t(P,C),t(C,Je),v(z,Je,null),t(P,ss),t(P,Xe),t(Xe,is),f(e,Dt,p),f(e,m,p),t(m,as),t(m,Ze),t(Ze,ls),t(m,rs),t(m,V),t(V,os),t(m,ns),t(m,Y),t(Y,ps),t(m,fs),t(m,Q),t(Q,us),t(m,hs),f(e,It,p),f(e,ge,p),t(ge,$),t($,cs),t($,W),t(W,ds),t($,ms),t($,K),t(K,gs),t($,_s),f(e,jt,p),f(e,B,p),t(B,bs),t(B,J),t(J,vs),t(B,ws),f(e,Pt,p),f(e,q,p),t(q,H),t(H,et),v(X,et,null),t(q,ys),t(q,tt),t(tt,Ss),f(e,$t,p),f(e,k,p),t(k,R),t(R,st),v(Z,st,null),t(k,Es),t(k,it),t(it,Ds),f(e,qt,p),f(e,E,p),t(E,Is),t(E,_e),t(_e,js),t(E,Ps),t(E,be),t(be,$s),t(E,qs),f(e,kt,p),f(e,g,p),t(g,x),t(x,at),t(at,ks),t(x,xs),t(x,ee),t(ee,As),t(x,Ms),t(x,ve),t(ve,Ls),t(g,Ts),t(g,A),t(A,lt),t(lt,Ns),t(A,Os),t(A,te),t(te,Us),t(A,Cs),t(A,we),t(we,Bs),t(g,Hs),t(g,M),t(M,rt),t(rt,Rs),t(M,Fs),t(M,se),t(se,Gs),t(M,zs),t(M,ye),t(ye,Vs),t(g,Ys),t(g,L),t(L,ot),t(ot,Qs),t(L,Ws),t(L,ie),t(ie,Ks),t(L,Js),t(L,Se),t(Se,Xs),t(g,Zs),t(g,T),t(T,nt),t(nt,ei),t(T,ti),t(T,ae),t(ae,si),t(T,ii),t(T,pt),t(pt,ai),f(e,xt,p),f(e,F,p),t(F,li),t(F,Ee),t(Ee,ri),t(F,oi),f(e,At,p),f(e,De,p),t(De,Ie),t(Ie,ft),t(ft,ni),t(Ie,pi),f(e,Mt,p),v(le,e,p),f(e,Lt,p),f(e,je,p),t(je,Pe),t(Pe,ut),t(ut,fi),t(Pe,ui),f(e,Tt,p),v(re,e,p),f(e,Nt,p),f(e,$e,p),t($e,qe),t(qe,ht),t(ht,hi),t(qe,ci),f(e,Ot,p),v(oe,e,p),f(e,Ut,p),f(e,ke,p),t(ke,N),t(N,ct),t(ct,di),t(N,mi),t(N,ne),t(ne,gi),t(N,_i),t(N,xe),t(xe,bi),f(e,Ct,p),v(pe,e,p),f(e,Bt,p),f(e,Ae,p),t(Ae,O),t(O,dt),t(dt,vi),t(O,wi),t(O,fe),t(fe,yi),t(O,Si),t(O,mt),t(mt,Ei),f(e,Ht,p),f(e,Me,p),t(Me,gt),t(gt,Di),f(e,Rt,p),v(ue,e,p),f(e,Ft,p),f(e,Le,p),t(Le,_t),t(_t,Ii),f(e,Gt,p),v(he,e,p),f(e,zt,p),f(e,U,p),t(U,G),t(G,bt),v(ce,bt,null),t(U,ji),t(U,vt),t(vt,Pi),f(e,Vt,p),f(e,c,p),t(c,$i),t(c,Te),t(Te,qi),t(c,ki),t(c,wt),t(wt,xi),t(c,Ai),t(c,Ne),t(Ne,Mi),t(c,Li),t(c,Oe),t(Oe,Ti),t(c,Ni),t(c,Ue),t(Ue,Oi),t(c,Ui),t(c,Ce),t(Ce,Ci),t(c,Bi),t(c,Be),t(Be,Hi),t(c,Ri),t(c,yt),t(yt,Fi),t(c,Gi),t(c,St),t(St,zi),t(c,Vi),t(c,He),t(He,Yi),t(c,Qi),f(e,Yt,p),v(de,e,p),Qt=!0},p:ml,i(e){Qt||(w(z.$$.fragment,e),w(X.$$.fragment,e),w(Z.$$.fragment,e),w(le.$$.fragment,e),w(re.$$.fragment,e),w(oe.$$.fragment,e),w(pe.$$.fragment,e),w(ue.$$.fragment,e),w(he.$$.fragment,e),w(ce.$$.fragment,e),w(de.$$.fragment,e),Qt=!0)},o(e){y(z.$$.fragment,e),y(X.$$.fragment,e),y(Z.$$.fragment,e),y(le.$$.fragment,e),y(re.$$.fragment,e),y(oe.$$.fragment,e),y(pe.$$.fragment,e),y(ue.$$.fragment,e),y(he.$$.fragment,e),y(ce.$$.fragment,e),y(de.$$.fragment,e),Qt=!1},d(e){s(j),e&&s(Et),e&&s(P),S(z),e&&s(Dt),e&&s(m),e&&s(It),e&&s(ge),e&&s(jt),e&&s(B),e&&s(Pt),e&&s(q),S(X),e&&s($t),e&&s(k),S(Z),e&&s(qt),e&&s(E),e&&s(kt),e&&s(g),e&&s(xt),e&&s(F),e&&s(At),e&&s(De),e&&s(Mt),S(le,e),e&&s(Lt),e&&s(je),e&&s(Tt),S(re,e),e&&s(Nt),e&&s($e),e&&s(Ot),S(oe,e),e&&s(Ut),e&&s(ke),e&&s(Ct),S(pe,e),e&&s(Bt),e&&s(Ae),e&&s(Ht),e&&s(Me),e&&s(Rt),S(ue,e),e&&s(Ft),e&&s(Le),e&&s(Gt),S(he,e),e&&s(zt),e&&s(U),S(ce),e&&s(Vt),e&&s(c),e&&s(Yt),S(de,e)}}}const bl={local:"stable-diffusion-2",sections:[{local:"tips",sections:[{local:"available-checkpoints",title:"Available checkpoints:"},{local:"how-to-load-and-use-different-schedulers",title:"How to load and use different schedulers."}],title:"Tips"}],title:"Stable diffusion 2"};function vl(Xi){return gl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class El extends ul{constructor(j){super();hl(this,j,vl,_l,cl,{})}}export{El as default,bl as metadata};
