import{S as ya,i as ba,s as wa,e as a,k as f,w as G,t as n,M as Ma,c as s,d as l,m as c,a as o,x as I,h as r,b as i,G as t,g as h,y as k,q as S,o as X,B as R,v as Ja}from"../../../../chunks/vendor-hf-doc-builder.js";import{T as ga}from"../../../../chunks/Tip-hf-doc-builder.js";import{I as lt}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{C as It}from"../../../../chunks/CodeBlock-hf-doc-builder.js";function Ta(at){let u,D,m,J,N,g,y,Q,v,z,d,Z,x,ee,U,j,te;return{c(){u=a("p"),D=n("Make sure to check out the Stable Diffusion "),m=a("a"),J=n("Tips"),N=n(" section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!"),g=f(),y=a("p"),Q=n("If you\u2019re interested in using one of the official checkpoints for a task, explore the "),v=a("a"),z=n("CompVis"),d=n(", "),Z=a("a"),x=n("Runway"),ee=n(", and "),U=a("a"),j=n("Stability AI"),te=n(" Hub organizations!"),this.h()},l(w){u=s(w,"P",{});var b=o(u);D=r(b,"Make sure to check out the Stable Diffusion "),m=s(b,"A",{href:!0});var Ue=o(m);J=r(Ue,"Tips"),Ue.forEach(l),N=r(b," section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!"),b.forEach(l),g=c(w),y=s(w,"P",{});var T=o(y);Q=r(T,"If you\u2019re interested in using one of the official checkpoints for a task, explore the "),v=s(T,"A",{href:!0,rel:!0});var B=o(v);z=r(B,"CompVis"),B.forEach(l),d=r(T,", "),Z=s(T,"A",{href:!0,rel:!0});var je=o(Z);x=r(je,"Runway"),je.forEach(l),ee=r(T,", and "),U=s(T,"A",{href:!0,rel:!0});var Be=o(U);j=r(Be,"Stability AI"),Be.forEach(l),te=r(T," Hub organizations!"),T.forEach(l),this.h()},h(){i(m,"href","overview#tips"),i(v,"href","https://huggingface.co/CompVis"),i(v,"rel","nofollow"),i(Z,"href","https://huggingface.co/runwayml"),i(Z,"rel","nofollow"),i(U,"href","https://huggingface.co/stability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MEFwaXBlLnNjaGVkdWxlciUyMCUzRCUyMERQTVNvbHZlck11bHRpc3RlcFNjaGVkdWxlci5mcm9tX2NvbmZpZyhwaXBlLnNjaGVkdWxlci5jb25maWcpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJIaWdoJTIwcXVhbGl0eSUyMHBob3RvJTIwb2YlMjBhbiUyMGFzdHJvbmF1dCUyMHJpZGluZyUyMGElMjBob3JzZSUyMGluJTIwc3BhY2UlMjIlMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDI1KS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSglMjJhc3Ryb25hdXQucG5nJTIyKQ==",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>)`}}),we=new lt({}),Me=new It({props:{code:"aW1wb3J0JTIwUElMJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBpbyUyMGltcG9ydCUyMEJ5dGVzSU8lMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZW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X3ByZXRyYWluZWQocmVwb19pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHJldmlzaW9uJTNEJTIyZnAxNiUyMiklMEElMEFwaXBlLnNjaGVkdWxlciUyMCUzRCUyMERQTVNvbHZlck11bHRpc3RlcFNjaGVkdWxlci5mcm9tX2NvbmZpZyhwaXBlLnNjaGVkdWxlci5jb25maWcpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJGYWNlJTIwb2YlMjBhJTIweWVsbG93JTIwY2F0JTJDJTIwaGlnaCUyMHJlc29sdXRpb24lMkMlMjBzaXR0aW5nJTIwb24lMjBhJTIwcGFyayUyMGJlbmNoJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUzRHByb21wdCUyQyUyMGltYWdlJTNEaW5pdF9pbWFnZSUyQyUyMG1hc2tfaW1hZ2UlM0RtYXNrX2ltYWdlJTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDI1KS5pbWFnZXMlNUIwJTVEJTBBJTBBaW1hZ2Uuc2F2ZSglMjJ5ZWxsb3dfY2F0LnBuZyUyMik=",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>)`}}),Je=new lt({}),ge=new It({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwaW8lMjBpbXBvcnQlMjBCeXRlc0lPJTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblVwc2NhbGVQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBJTIzJTIwbG9hZCUyMG1vZGVsJTIwYW5kJTIwc2NoZWR1bGVyJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teDQtdXBzY2FsZXIlMjIlMEFwaXBlbGluZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblVwc2NhbGVQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZWxpbmUlMjAlM0QlMjBwaXBlbGluZS50byglMjJjdWRhJTIyKSUwQSUwQSUyMyUyMGxldCdzJTIwZG93bmxvYWQlMjBhbiUyMCUyMGltYWdlJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRnNkMi11cHNjYWxlJTJGbG93X3Jlc19jYXQucG5nJTIyJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQWxvd19yZXNfaW1nJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFsb3dfcmVzX2ltZyUyMCUzRCUyMGxvd19yZXNfaW1nLnJlc2l6ZSgoMTI4JTJDJTIwMTI4KSklMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwd2hpdGUlMjBjYXQlMjIlMEF1cHNjYWxlZF9pbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUzRHByb21wdCUyQyUyMGltYWdlJTNEbG93X3Jlc19pbWcpLmltYWdlcyU1QjAlNUQlMEF1cHNjYWxlZF9pbWFnZS5zYXZlKCUyMnVwc2FtcGxlZF9jYXQucG5nJTIyKQ==",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>)`}}),Te=new lt({}),ve=new It({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQSUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBTdGFibGVEaWZmdXNpb25EZXB0aDJJbWdQaXBlbGluZSUwQSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25EZXB0aDJJbWdQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTItZGVwdGglMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMEEpLnRvKCUyMmN1ZGElMjIpJTBBJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWluaXRfaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBcHJvbXB0JTIwJTNEJTIwJTIydHdvJTIwdGlnZXJzJTIyJTBBbl9wcm9wbXQlMjAlM0QlMjAlMjJiYWQlMkMlMjBkZWZvcm1lZCUyQyUyMHVnbHklMkMlMjBiYWQlMjBhbm90b215JTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUzRHByb21wdCUyQyUyMGltYWdlJTNEaW5pdF9pbWFnZSUyQyUyMG5lZ2F0aXZlX3Byb21wdCUzRG5fcHJvcG10JTJDJTIwc3RyZW5ndGglM0QwLjcpLmltYWdlcyU1QjAlNUQ=",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>]`}}),{c(){u=a("meta"),D=f(),m=a("h1"),J=a("a"),N=a("span"),G(g.$$.fragment),y=f(),Q=a("span"),v=n("Stable Diffusion 2"),z=f(),d=a("p"),Z=n("Stable Diffusion 2 is a text-to-image "),x=a("em"),ee=n("latent diffusion"),U=n(" model built upon the work of the original "),j=a("a"),te=n("Stable Diffusion"),w=n(", and it was led by Robin Rombach and Katherine Crowson from "),b=a("a"),Ue=n("Stability AI"),T=n(" and "),B=a("a"),je=n("LAION"),Be=n("."),st=f(),Ee=a("p"),F=a("em"),kt=n(`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 `),le=a("a"),St=n("LAION-5B dataset"),Xt=n(" created by the DeepFloyd team at Stability AI, which is then further filtered to remove adult content using "),ae=a("a"),Rt=n("LAION\u2019s NSFW filter"),Nt=n("."),ot=f(),C=a("p"),Qt=n("For more details about how Stable Diffusion 2 works and how it differs from the original Stable Diffusion, please refer to the official "),se=a("a"),xt=n("announcement post"),Ft=n("."),it=f(),E=a("p"),$t=n("The architecture of Stable Diffusion 2 is more or less identical to the original "),We=a("a"),Vt=n("Stable Diffusion model"),At=n(" so check out it\u2019s API documentation for how to use Stable Diffusion 2. We recommend using the "),_e=a("a"),Yt=n("DPMSolverMultistepScheduler"),Dt=n(" as it\u2019s currently the fastest scheduler."),nt=f(),Ge=a("p"),zt=n("Stable Diffusion 2 is available for tasks like text-to-image, inpainting, super-resolution, and depth-to-image:"),rt=f(),H=a("table"),Xe=a("thead"),oe=a("tr"),Re=a("th"),Ct=n("Task"),Ht=f(),Ne=a("th"),qt=n("Repository"),Pt=f(),M=a("tbody"),ie=a("tr"),Qe=a("td"),Lt=n("text-to-image (512x512)"),Kt=f(),xe=a("td"),ne=a("a"),Ot=n("stabilityai/stable-diffusion-2-base"),el=f(),re=a("tr"),Fe=a("td"),tl=n("text-to-image (768x768)"),ll=f(),$e=a("td"),pe=a("a"),al=n("stabilityai/stable-diffusion-2"),sl=f(),fe=a("tr"),Ve=a("td"),ol=n("inpainting"),il=f(),Ae=a("td"),ce=a("a"),nl=n("stabilityai/stable-diffusion-2-inpainting"),rl=f(),he=a("tr"),Ye=a("td"),pl=n("super-resolution"),fl=f(),De=a("td"),ue=a("a"),cl=n("stable-diffusion-x4-upscaler"),hl=f(),de=a("tr"),ze=a("td"),ul=n("depth-to-image"),dl=f(),Ce=a("td"),me=a("a"),ml=n("stabilityai/stable-diffusion-2-depth"),pt=f(),Ie=a("p"),yl=n("Here are some examples for how to use Stable Diffusion 2 for each task:"),ft=f(),G(q.$$.fragment),ct=f(),$=a("h2"),P=a("a"),He=a("span"),G(ye.$$.fragment),bl=f(),qe=a("span"),wl=n("Text-to-image"),ht=f(),G(be.$$.fragment),ut=f(),V=a("h2"),L=a("a"),Pe=a("span"),G(we.$$.fragment),Ml=f(),Le=a("span"),Jl=n("Inpainting"),dt=f(),G(Me.$$.fragment),mt=f(),A=a("h2"),K=a("a"),Ke=a("span"),G(Je.$$.fragment),gl=f(),Oe=a("span"),Tl=n("Super-resolution"),yt=f(),G(ge.$$.fragment),bt=f(),Y=a("h2"),O=a("a"),et=a("span"),G(Te.$$.fragment),vl=f(),tt=a("span"),Zl=n("Depth-to-image"),wt=f(),G(ve.$$.fragment),this.h()},l(e){const p=Ma('[data-svelte="svelte-1phssyn"]',document.head);u=s(p,"META",{name:!0,content:!0}),p.forEach(l),D=c(e),m=s(e,"H1",{class:!0});var Ze=o(m);J=s(Ze,"A",{id:!0,class:!0,href:!0});var Ul=o(J);N=s(Ul,"SPAN",{});var jl=o(N);I(g.$$.fragment,jl),jl.forEach(l),Ul.forEach(l),y=c(Ze),Q=s(Ze,"SPAN",{});var Bl=o(Q);v=r(Bl,"Stable Diffusion 2"),Bl.forEach(l),Ze.forEach(l),z=c(e),d=s(e,"P",{});var W=o(d);Z=r(W,"Stable Diffusion 2 is a text-to-image "),x=s(W,"EM",{});var El=o(x);ee=r(El,"latent diffusion"),El.forEach(l),U=r(W," model built upon the work of the original "),j=s(W,"A",{href:!0,rel:!0});var Wl=o(j);te=r(Wl,"Stable Diffusion"),Wl.forEach(l),w=r(W,", and it was led by Robin Rombach and Katherine Crowson from "),b=s(W,"A",{href:!0,rel:!0});var _l=o(b);Ue=r(_l,"Stability AI"),_l.forEach(l),T=r(W," and "),B=s(W,"A",{href:!0,rel:!0});var Gl=o(B);je=r(Gl,"LAION"),Gl.forEach(l),Be=r(W,"."),W.forEach(l),st=c(e),Ee=s(e,"P",{});var Il=o(Ee);F=s(Il,"EM",{});var ke=o(F);kt=r(ke,`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 `),le=s(ke,"A",{href:!0,rel:!0});var kl=o(le);St=r(kl,"LAION-5B dataset"),kl.forEach(l),Xt=r(ke," created by the DeepFloyd team at Stability AI, which is then further filtered to remove adult content using "),ae=s(ke,"A",{href:!0,rel:!0});var Sl=o(ae);Rt=r(Sl,"LAION\u2019s NSFW filter"),Sl.forEach(l),Nt=r(ke,"."),ke.forEach(l),Il.forEach(l),ot=c(e),C=s(e,"P",{});var Jt=o(C);Qt=r(Jt,"For more details about how Stable Diffusion 2 works and how it differs from the original Stable Diffusion, please refer to the official "),se=s(Jt,"A",{href:!0,rel:!0});var Xl=o(se);xt=r(Xl,"announcement post"),Xl.forEach(l),Ft=r(Jt,"."),Jt.forEach(l),it=c(e),E=s(e,"P",{});var Se=o(E);$t=r(Se,"The architecture of Stable Diffusion 2 is more or less identical to the original "),We=s(Se,"A",{href:!0});var Rl=o(We);Vt=r(Rl,"Stable Diffusion model"),Rl.forEach(l),At=r(Se," so check out it\u2019s API documentation for how to use Stable Diffusion 2. We recommend using the "),_e=s(Se,"A",{href:!0});var Nl=o(_e);Yt=r(Nl,"DPMSolverMultistepScheduler"),Nl.forEach(l),Dt=r(Se," as it\u2019s currently the fastest scheduler."),Se.forEach(l),nt=c(e),Ge=s(e,"P",{});var Ql=o(Ge);zt=r(Ql,"Stable Diffusion 2 is available for tasks like text-to-image, inpainting, super-resolution, and depth-to-image:"),Ql.forEach(l),rt=c(e),H=s(e,"TABLE",{});var gt=o(H);Xe=s(gt,"THEAD",{});var xl=o(Xe);oe=s(xl,"TR",{});var Tt=o(oe);Re=s(Tt,"TH",{});var Fl=o(Re);Ct=r(Fl,"Task"),Fl.forEach(l),Ht=c(Tt),Ne=s(Tt,"TH",{});var $l=o(Ne);qt=r($l,"Repository"),$l.forEach(l),Tt.forEach(l),xl.forEach(l),Pt=c(gt),M=s(gt,"TBODY",{});var _=o(M);ie=s(_,"TR",{});var vt=o(ie);Qe=s(vt,"TD",{});var Vl=o(Qe);Lt=r(Vl,"text-to-image (512x512)"),Vl.forEach(l),Kt=c(vt),xe=s(vt,"TD",{});var Al=o(xe);ne=s(Al,"A",{href:!0,rel:!0});var Yl=o(ne);Ot=r(Yl,"stabilityai/stable-diffusion-2-base"),Yl.forEach(l),Al.forEach(l),vt.forEach(l),el=c(_),re=s(_,"TR",{});var Zt=o(re);Fe=s(Zt,"TD",{});var Dl=o(Fe);tl=r(Dl,"text-to-image (768x768)"),Dl.forEach(l),ll=c(Zt),$e=s(Zt,"TD",{});var zl=o($e);pe=s(zl,"A",{href:!0,rel:!0});var Cl=o(pe);al=r(Cl,"stabilityai/stable-diffusion-2"),Cl.forEach(l),zl.forEach(l),Zt.forEach(l),sl=c(_),fe=s(_,"TR",{});var Ut=o(fe);Ve=s(Ut,"TD",{});var Hl=o(Ve);ol=r(Hl,"inpainting"),Hl.forEach(l),il=c(Ut),Ae=s(Ut,"TD",{});var ql=o(Ae);ce=s(ql,"A",{href:!0,rel:!0});var Pl=o(ce);nl=r(Pl,"stabilityai/stable-diffusion-2-inpainting"),Pl.forEach(l),ql.forEach(l),Ut.forEach(l),rl=c(_),he=s(_,"TR",{});var jt=o(he);Ye=s(jt,"TD",{});var Ll=o(Ye);pl=r(Ll,"super-resolution"),Ll.forEach(l),fl=c(jt),De=s(jt,"TD",{});var Kl=o(De);ue=s(Kl,"A",{href:!0,rel:!0});var Ol=o(ue);cl=r(Ol,"stable-diffusion-x4-upscaler"),Ol.forEach(l),Kl.forEach(l),jt.forEach(l),hl=c(_),de=s(_,"TR",{});var Bt=o(de);ze=s(Bt,"TD",{});var ea=o(ze);ul=r(ea,"depth-to-image"),ea.forEach(l),dl=c(Bt),Ce=s(Bt,"TD",{});var ta=o(Ce);me=s(ta,"A",{href:!0,rel:!0});var la=o(me);ml=r(la,"stabilityai/stable-diffusion-2-depth"),la.forEach(l),ta.forEach(l),Bt.forEach(l),_.forEach(l),gt.forEach(l),pt=c(e),Ie=s(e,"P",{});var aa=o(Ie);yl=r(aa,"Here are some examples for how to use Stable Diffusion 2 for each task:"),aa.forEach(l),ft=c(e),I(q.$$.fragment,e),ct=c(e),$=s(e,"H2",{class:!0});var Et=o($);P=s(Et,"A",{id:!0,class:!0,href:!0});var sa=o(P);He=s(sa,"SPAN",{});var oa=o(He);I(ye.$$.fragment,oa),oa.forEach(l),sa.forEach(l),bl=c(Et),qe=s(Et,"SPAN",{});var ia=o(qe);wl=r(ia,"Text-to-image"),ia.forEach(l),Et.forEach(l),ht=c(e),I(be.$$.fragment,e),ut=c(e),V=s(e,"H2",{class:!0});var Wt=o(V);L=s(Wt,"A",{id:!0,class:!0,href:!0});var na=o(L);Pe=s(na,"SPAN",{});var ra=o(Pe);I(we.$$.fragment,ra),ra.forEach(l),na.forEach(l),Ml=c(Wt),Le=s(Wt,"SPAN",{});var pa=o(Le);Jl=r(pa,"Inpainting"),pa.forEach(l),Wt.forEach(l),dt=c(e),I(Me.$$.fragment,e),mt=c(e),A=s(e,"H2",{class:!0});var _t=o(A);K=s(_t,"A",{id:!0,class:!0,href:!0});var fa=o(K);Ke=s(fa,"SPAN",{});var ca=o(Ke);I(Je.$$.fragment,ca),ca.forEach(l),fa.forEach(l),gl=c(_t),Oe=s(_t,"SPAN",{});var ha=o(Oe);Tl=r(ha,"Super-resolution"),ha.forEach(l),_t.forEach(l),yt=c(e),I(ge.$$.fragment,e),bt=c(e),Y=s(e,"H2",{class:!0});var Gt=o(Y);O=s(Gt,"A",{id:!0,class:!0,href:!0});var ua=o(O);et=s(ua,"SPAN",{});var da=o(et);I(Te.$$.fragment,da),da.forEach(l),ua.forEach(l),vl=c(Gt),tt=s(Gt,"SPAN",{});var ma=o(tt);Zl=r(ma,"Depth-to-image"),ma.forEach(l),Gt.forEach(l),wt=c(e),I(ve.$$.fragment,e),this.h()},h(){i(u,"name","hf:doc:metadata"),i(u,"content",JSON.stringify(Za)),i(J,"id","stable-diffusion-2"),i(J,"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"),i(J,"href","#stable-diffusion-2"),i(m,"class","relative group"),i(j,"href","https://stability.ai/blog/stable-diffusion-public-release"),i(j,"rel","nofollow"),i(b,"href","https://stability.ai/"),i(b,"rel","nofollow"),i(B,"href","https://laion.ai/"),i(B,"rel","nofollow"),i(le,"href","https://laion.ai/blog/laion-5b/"),i(le,"rel","nofollow"),i(ae,"href","https://openreview.net/forum?id=M3Y74vmsMcY"),i(ae,"rel","nofollow"),i(se,"href","https://stability.ai/blog/stable-diffusion-v2-release"),i(se,"rel","nofollow"),i(We,"href","./text2img"),i(_e,"href","/docs/diffusers/v0.21.0/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler"),i(ne,"href","https://huggingface.co/stabilityai/stable-diffusion-2-base"),i(ne,"rel","nofollow"),i(pe,"href","https://huggingface.co/stabilityai/stable-diffusion-2"),i(pe,"rel","nofollow"),i(ce,"href","https://huggingface.co/stabilityai/stable-diffusion-2-inpainting"),i(ce,"rel","nofollow"),i(ue,"href","https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler"),i(ue,"rel","nofollow"),i(me,"href","https://huggingface.co/stabilityai/stable-diffusion-2-depth"),i(me,"rel","nofollow"),i(P,"id","texttoimage"),i(P,"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"),i(P,"href","#texttoimage"),i($,"class","relative group"),i(L,"id","inpainting"),i(L,"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"),i(L,"href","#inpainting"),i(V,"class","relative group"),i(K,"id","superresolution"),i(K,"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"),i(K,"href","#superresolution"),i(A,"class","relative group"),i(O,"id","depthtoimage"),i(O,"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"),i(O,"href","#depthtoimage"),i(Y,"class","relative group")},m(e,p){t(document.head,u),h(e,D,p),h(e,m,p),t(m,J),t(J,N),k(g,N,null),t(m,y),t(m,Q),t(Q,v),h(e,z,p),h(e,d,p),t(d,Z),t(d,x),t(x,ee),t(d,U),t(d,j),t(j,te),t(d,w),t(d,b),t(b,Ue),t(d,T),t(d,B),t(B,je),t(d,Be),h(e,st,p),h(e,Ee,p),t(Ee,F),t(F,kt),t(F,le),t(le,St),t(F,Xt),t(F,ae),t(ae,Rt),t(F,Nt),h(e,ot,p),h(e,C,p),t(C,Qt),t(C,se),t(se,xt),t(C,Ft),h(e,it,p),h(e,E,p),t(E,$t),t(E,We),t(We,Vt),t(E,At),t(E,_e),t(_e,Yt),t(E,Dt),h(e,nt,p),h(e,Ge,p),t(Ge,zt),h(e,rt,p),h(e,H,p),t(H,Xe),t(Xe,oe),t(oe,Re),t(Re,Ct),t(oe,Ht),t(oe,Ne),t(Ne,qt),t(H,Pt),t(H,M),t(M,ie),t(ie,Qe),t(Qe,Lt),t(ie,Kt),t(ie,xe),t(xe,ne),t(ne,Ot),t(M,el),t(M,re),t(re,Fe),t(Fe,tl),t(re,ll),t(re,$e),t($e,pe),t(pe,al),t(M,sl),t(M,fe),t(fe,Ve),t(Ve,ol),t(fe,il),t(fe,Ae),t(Ae,ce),t(ce,nl),t(M,rl),t(M,he),t(he,Ye),t(Ye,pl),t(he,fl),t(he,De),t(De,ue),t(ue,cl),t(M,hl),t(M,de),t(de,ze),t(ze,ul),t(de,dl),t(de,Ce),t(Ce,me),t(me,ml),h(e,pt,p),h(e,Ie,p),t(Ie,yl),h(e,ft,p),k(q,e,p),h(e,ct,p),h(e,$,p),t($,P),t(P,He),k(ye,He,null),t($,bl),t($,qe),t(qe,wl),h(e,ht,p),k(be,e,p),h(e,ut,p),h(e,V,p),t(V,L),t(L,Pe),k(we,Pe,null),t(V,Ml),t(V,Le),t(Le,Jl),h(e,dt,p),k(Me,e,p),h(e,mt,p),h(e,A,p),t(A,K),t(K,Ke),k(Je,Ke,null),t(A,gl),t(A,Oe),t(Oe,Tl),h(e,yt,p),k(ge,e,p),h(e,bt,p),h(e,Y,p),t(Y,O),t(O,et),k(Te,et,null),t(Y,vl),t(Y,tt),t(tt,Zl),h(e,wt,p),k(ve,e,p),Mt=!0},p(e,[p]){const Ze={};p&2&&(Ze.$$scope={dirty:p,ctx:e}),q.$set(Ze)},i(e){Mt||(S(g.$$.fragment,e),S(q.$$.fragment,e),S(ye.$$.fragment,e),S(be.$$.fragment,e),S(we.$$.fragment,e),S(Me.$$.fragment,e),S(Je.$$.fragment,e),S(ge.$$.fragment,e),S(Te.$$.fragment,e),S(ve.$$.fragment,e),Mt=!0)},o(e){X(g.$$.fragment,e),X(q.$$.fragment,e),X(ye.$$.fragment,e),X(be.$$.fragment,e),X(we.$$.fragment,e),X(Me.$$.fragment,e),X(Je.$$.fragment,e),X(ge.$$.fragment,e),X(Te.$$.fragment,e),X(ve.$$.fragment,e),Mt=!1},d(e){l(u),e&&l(D),e&&l(m),R(g),e&&l(z),e&&l(d),e&&l(st),e&&l(Ee),e&&l(ot),e&&l(C),e&&l(it),e&&l(E),e&&l(nt),e&&l(Ge),e&&l(rt),e&&l(H),e&&l(pt),e&&l(Ie),e&&l(ft),R(q,e),e&&l(ct),e&&l($),R(ye),e&&l(ht),R(be,e),e&&l(ut),e&&l(V),R(we),e&&l(dt),R(Me,e),e&&l(mt),e&&l(A),R(Je),e&&l(yt),R(ge,e),e&&l(bt),e&&l(Y),R(Te),e&&l(wt),R(ve,e)}}}const Za={local:"stable-diffusion-2",sections:[{local:"texttoimage",title:"Text-to-image"},{local:"inpainting",title:"Inpainting"},{local:"superresolution",title:"Super-resolution"},{local:"depthtoimage",title:"Depth-to-image"}],title:"Stable Diffusion 2"};function Ua(at){return Ja(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _a extends ya{constructor(u){super();ba(this,u,Ua,va,wa,{})}}export{_a as default,Za as metadata};
