import{S as sl,i as rl,s as ll,e as o,k as c,w as $,t as i,M as dl,c as n,d as t,m as f,a,x as D,h as s,b as u,G as e,g as T,y as P,q as k,o as S,B as E,v as cl,L as Vt}from"../../../../chunks/vendor-hf-doc-builder.js";import{T as Sn}from"../../../../chunks/Tip-hf-doc-builder.js";import{D as L}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as zt}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as il}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ut}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function fl(I){let d,b,p,m,x;return m=new zt({props:{code:`import torch
from diffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
pipe = pipe.to("cuda")

prompt = "a photo of an astronaut riding a horse on mars"
image = pipe(prompt).images[0]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableDiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;a photo of an astronaut riding a horse on mars&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt).images[<span class="hljs-number">0</span>]`}}),{c(){d=o("p"),b=i("Examples:"),p=c(),$(m.$$.fragment)},l(l){d=n(l,"P",{});var h=a(d);b=s(h,"Examples:"),h.forEach(t),p=f(l),D(m.$$.fragment,l)},m(l,h){T(l,d,h),e(d,b),T(l,p,h),P(m,l,h),x=!0},p:Vt,i(l){x||(k(m.$$.fragment,l),x=!0)},o(l){S(m.$$.fragment,l),x=!1},d(l){l&&t(d),l&&t(p),E(m,l)}}}function pl(I){let d,b,p,m,x;return m=new zt({props:{code:`import torch
from diffusers import DiffusionPipeline
from xformers.ops import MemoryEfficientAttentionFlashAttentionOp

pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16)
pipe = pipe.to("cuda")
pipe.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp)
# Workaround for not accepting attention shape using VAE for Flash Attention
pipe.vae.enable_xformers_memory_efficient_attention(attention_op=None)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> xformers.ops <span class="hljs-keyword">import</span> MemoryEfficientAttentionFlashAttentionOp

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;stabilityai/stable-diffusion-2-1&quot;</span>, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Workaround for not accepting attention shape using VAE for Flash Attention</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.vae.enable_xformers_memory_efficient_attention(attention_op=<span class="hljs-literal">None</span>)`}}),{c(){d=o("p"),b=i("Examples:"),p=c(),$(m.$$.fragment)},l(l){d=n(l,"P",{});var h=a(d);b=s(h,"Examples:"),h.forEach(t),p=f(l),D(m.$$.fragment,l)},m(l,h){T(l,d,h),e(d,b),T(l,p,h),P(m,l,h),x=!0},p:Vt,i(l){x||(k(m.$$.fragment,l),x=!0)},o(l){S(m.$$.fragment,l),x=!1},d(l){l&&t(d),l&&t(p),E(m,l)}}}function ul(I){let d,b;return{c(){d=o("p"),b=i("This function is experimental and might change in the future.")},l(p){d=n(p,"P",{});var m=a(d);b=s(m,"This function is experimental and might change in the future."),m.forEach(t)},m(p,m){T(p,d,m),e(d,b)},d(p){p&&t(d)}}}function ml(I){let d,b,p,m,x,l,h,j;return{c(){d=o("p"),b=i("It is required to be logged in ("),p=o("code"),m=i("huggingface-cli login"),x=i(") when you want to use private or "),l=o("a"),h=i(`gated
models`),j=i("."),this.h()},l(_){d=n(_,"P",{});var w=a(d);b=s(w,"It is required to be logged in ("),p=n(w,"CODE",{});var A=a(p);m=s(A,"huggingface-cli login"),A.forEach(t),x=s(w,") when you want to use private or "),l=n(w,"A",{href:!0,rel:!0});var O=a(l);h=s(O,`gated
models`),O.forEach(t),j=s(w,"."),w.forEach(t),this.h()},h(){u(l,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),u(l,"rel","nofollow")},m(_,w){T(_,d,w),e(d,b),e(d,p),e(p,m),e(d,x),e(d,l),e(l,h),e(d,j)},d(_){_&&t(d)}}}function hl(I){let d,b,p,m,x,l,h,j;return h=new zt({props:{code:`from diffusers import StableDiffusionPipeline
import torch

model_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")

pipe.load_textual_inversion("sd-concepts-library/cat-toy")

prompt = "A <cat-toy> backpack"

image = pipe(prompt, num_inference_steps=50).images[0]
image.save("cat-backpack.png")`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline
<span class="hljs-keyword">import</span> torch

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipe.load_textual_inversion(<span class="hljs-string">&quot;sd-concepts-library/cat-toy&quot;</span>)

prompt = <span class="hljs-string">&quot;A &lt;cat-toy&gt; backpack&quot;</span>

image = pipe(prompt, num_inference_steps=<span class="hljs-number">50</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;cat-backpack.png&quot;</span>)`}}),{c(){d=o("p"),b=i("To load a textual inversion embedding vector in "),p=o("code"),m=i("diffusers"),x=i(" format:"),l=c(),$(h.$$.fragment)},l(_){d=n(_,"P",{});var w=a(d);b=s(w,"To load a textual inversion embedding vector in "),p=n(w,"CODE",{});var A=a(p);m=s(A,"diffusers"),A.forEach(t),x=s(w," format:"),w.forEach(t),l=f(_),D(h.$$.fragment,_)},m(_,w){T(_,d,w),e(d,b),e(d,p),e(p,m),e(d,x),T(_,l,w),P(h,_,w),j=!0},p:Vt,i(_){j||(k(h.$$.fragment,_),j=!0)},o(_){S(h.$$.fragment,_),j=!1},d(_){_&&t(d),_&&t(l),E(h,_)}}}function gl(I){let d,b,p,m,x,l,h,j;return h=new zt({props:{code:`from diffusers import StableDiffusionPipeline
import torch

model_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")

pipe.load_textual_inversion("./charturnerv2.pt", token="charturnerv2")

prompt = "charturnerv2, multiple views of the same character in the same outfit, a character turnaround of a woman wearing a black jacket and red shirt, best quality, intricate details."

image = pipe(prompt, num_inference_steps=50).images[0]
image.save("character.png")`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline
<span class="hljs-keyword">import</span> torch

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipe.load_textual_inversion(<span class="hljs-string">&quot;./charturnerv2.pt&quot;</span>, token=<span class="hljs-string">&quot;charturnerv2&quot;</span>)

prompt = <span class="hljs-string">&quot;charturnerv2, multiple views of the same character in the same outfit, a character turnaround of a woman wearing a black jacket and red shirt, best quality, intricate details.&quot;</span>

image = pipe(prompt, num_inference_steps=<span class="hljs-number">50</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;character.png&quot;</span>)`}}),{c(){d=o("p"),b=i("e.g. from "),p=o("a"),m=i("civitAI"),x=i(" and then load the vector locally:"),l=c(),$(h.$$.fragment),this.h()},l(_){d=n(_,"P",{});var w=a(d);b=s(w,"e.g. from "),p=n(w,"A",{href:!0,rel:!0});var A=a(p);m=s(A,"civitAI"),A.forEach(t),x=s(w," and then load the vector locally:"),w.forEach(t),l=f(_),D(h.$$.fragment,_),this.h()},h(){u(p,"href","https://civitai.com/models/3036?modelVersionId=9857"),u(p,"rel","nofollow")},m(_,w){T(_,d,w),e(d,b),e(d,p),e(p,m),e(d,x),T(_,l,w),P(h,_,w),j=!0},p:Vt,i(_){j||(k(h.$$.fragment,_),j=!0)},o(_){S(h.$$.fragment,_),j=!1},d(_){_&&t(d),_&&t(l),E(h,_)}}}function _l(I){let d,b,p,m,x;return m=new zt({props:{code:`from diffusers import StableDiffusionPipeline

# Download pipeline from huggingface.co and cache.
pipeline = StableDiffusionPipeline.from_ckpt(
    "https://huggingface.co/WarriorMama777/OrangeMixs/blob/main/Models/AbyssOrangeMix/AbyssOrangeMix.safetensors"
)

# Download pipeline from local file
# file is downloaded under ./v1-5-pruned-emaonly.ckpt
pipeline = StableDiffusionPipeline.from_ckpt("./v1-5-pruned-emaonly")

# Enable float16 and move to GPU
pipeline = StableDiffusionPipeline.from_ckpt(
    "https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.ckpt",
    torch_dtype=torch.float16,
)
pipeline.to("cuda")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download pipeline from huggingface.co and cache.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = StableDiffusionPipeline.from_ckpt(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/WarriorMama777/OrangeMixs/blob/main/Models/AbyssOrangeMix/AbyssOrangeMix.safetensors&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download pipeline from local file</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># file is downloaded under ./v1-5-pruned-emaonly.ckpt</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = StableDiffusionPipeline.from_ckpt(<span class="hljs-string">&quot;./v1-5-pruned-emaonly&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Enable float16 and move to GPU</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = StableDiffusionPipeline.from_ckpt(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.ckpt&quot;</span>,
<span class="hljs-meta">... </span>    torch_dtype=torch.float16,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),{c(){d=o("p"),b=i("Examples:"),p=c(),$(m.$$.fragment)},l(l){d=n(l,"P",{});var h=a(d);b=s(h,"Examples:"),h.forEach(t),p=f(l),D(m.$$.fragment,l)},m(l,h){T(l,d,h),e(d,b),T(l,p,h),P(m,l,h),x=!0},p:Vt,i(l){x||(k(m.$$.fragment,l),x=!0)},o(l){S(m.$$.fragment,l),x=!1},d(l){l&&t(d),l&&t(p),E(m,l)}}}function bl(I){let d,b;return{c(){d=o("p"),b=i("This function is experimental and might change in the future.")},l(p){d=n(p,"P",{});var m=a(d);b=s(m,"This function is experimental and might change in the future."),m.forEach(t)},m(p,m){T(p,d,m),e(d,b)},d(p){p&&t(d)}}}function vl(I){let d,b,p,m,x,l,h,j;return{c(){d=o("p"),b=i("It is required to be logged in ("),p=o("code"),m=i("huggingface-cli login"),x=i(") when you want to use private or "),l=o("a"),h=i(`gated
models`),j=i("."),this.h()},l(_){d=n(_,"P",{});var w=a(d);b=s(w,"It is required to be logged in ("),p=n(w,"CODE",{});var A=a(p);m=s(A,"huggingface-cli login"),A.forEach(t),x=s(w,") when you want to use private or "),l=n(w,"A",{href:!0,rel:!0});var O=a(l);h=s(O,`gated
models`),O.forEach(t),j=s(w,"."),w.forEach(t),this.h()},h(){u(l,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),u(l,"rel","nofollow")},m(_,w){T(_,d,w),e(d,b),e(d,p),e(p,m),e(d,x),e(d,l),e(l,h),e(d,j)},d(_){_&&t(d)}}}function yl(I){let d,b,p,m,x;return m=new zt({props:{code:`import jax
import numpy as np
from flax.jax_utils import replicate
from flax.training.common_utils import shard

from diffusers import FlaxStableDiffusionPipeline

pipeline, params = FlaxStableDiffusionPipeline.from_pretrained(
    "runwayml/stable-diffusion-v1-5", revision="bf16", dtype=jax.numpy.bfloat16
)

prompt = "a photo of an astronaut riding a horse on mars"

prng_seed = jax.random.PRNGKey(0)
num_inference_steps = 50

num_samples = jax.device_count()
prompt = num_samples * [prompt]
prompt_ids = pipeline.prepare_inputs(prompt)

params = replicate(params)
prng_seed = jax.random.split(prng_seed, jax.device_count())
prompt_ids = shard(prompt_ids)

images = pipeline(prompt_ids, params, prng_seed, num_inference_steps, jit=True).images
images = pipeline.numpy_to_pil(np.asarray(images.reshape((num_samples,) + images.shape[-3:])))`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> jax
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> flax.jax_utils <span class="hljs-keyword">import</span> replicate
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> flax.training.common_utils <span class="hljs-keyword">import</span> shard

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> FlaxStableDiffusionPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline, params = FlaxStableDiffusionPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, revision=<span class="hljs-string">&quot;bf16&quot;</span>, dtype=jax.numpy.bfloat16
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;a photo of an astronaut riding a horse on mars&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>prng_seed = jax.random.PRNGKey(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>num_inference_steps = <span class="hljs-number">50</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>num_samples = jax.device_count()
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = num_samples * [prompt]
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_ids = pipeline.prepare_inputs(prompt)
<span class="hljs-comment"># shard inputs and rng</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>params = replicate(params)
<span class="hljs-meta">&gt;&gt;&gt; </span>prng_seed = jax.random.split(prng_seed, jax.device_count())
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_ids = shard(prompt_ids)

<span class="hljs-meta">&gt;&gt;&gt; </span>images = pipeline(prompt_ids, params, prng_seed, num_inference_steps, jit=<span class="hljs-literal">True</span>).images
<span class="hljs-meta">&gt;&gt;&gt; </span>images = pipeline.numpy_to_pil(np.asarray(images.reshape((num_samples,) + images.shape[-<span class="hljs-number">3</span>:])))`}}),{c(){d=o("p"),b=i("Examples:"),p=c(),$(m.$$.fragment)},l(l){d=n(l,"P",{});var h=a(d);b=s(h,"Examples:"),h.forEach(t),p=f(l),D(m.$$.fragment,l)},m(l,h){T(l,d,h),e(d,b),T(l,p,h),P(m,l,h),x=!0},p:Vt,i(l){x||(k(m.$$.fragment,l),x=!0)},o(l){S(m.$$.fragment,l),x=!1},d(l){l&&t(d),l&&t(p),E(m,l)}}}function xl(I){let d,b,p,m,x,l,h,j,_,w,A,O,Wt,De,En,Gt,Tn,Ko,q,jn,Pe,In,An,ke,Cn,Ln,Se,qn,Mn,Ee,Fn,Nn,wt,On,Un,Bo,$t,Vn,Ho,ne,Te,Rt,zn,Wn,je,Gn,Rn,Ie,Kt,Kn,Bn,Ae,Hn,Xo,Dt,Xn,Jo,M,Ce,Bt,Jn,Qn,Le,Yn,Zn,qe,Ht,ea,ta,Me,oa,na,Fe,Xt,aa,ia,Ne,sa,ra,Oe,Jt,la,da,Ue,ca,fa,Ve,Qt,pa,ua,ze,ma,ha,We,Yt,ga,_a,Ge,ba,Qo,g,Re,va,Zt,ya,xa,Ke,wa,Pt,$a,Da,Pa,eo,ka,Sa,Z,Be,to,Ea,Ta,kt,ja,Ia,He,oo,Aa,Ca,St,La,qa,Xe,no,Ma,Fa,Et,Na,Oa,ao,Ua,Va,io,Je,so,za,Wa,Tt,Ga,Ra,K,Qe,Ka,ro,Ba,Ha,ae,Xa,B,Ye,Ja,lo,Qa,Ya,co,Za,ei,ie,Ze,ti,et,oi,fo,ni,ai,ii,H,tt,si,po,ri,li,uo,di,ci,se,ot,fi,nt,pi,mo,ui,mi,hi,U,at,gi,ho,_i,bi,go,vi,yi,_o,xi,wi,re,$i,le,it,Di,bo,Pi,ki,X,st,Si,vo,Ei,Ti,yo,ji,Ii,de,rt,Ai,lt,Ci,xo,Li,qi,Mi,C,dt,Fi,ee,Ni,wo,Oi,Ui,$o,Vi,zi,Wi,ce,Gi,fe,Ri,Do,Ki,Bi,pe,Hi,Po,Xi,Ji,ue,Qi,W,ct,Yi,ko,Zi,es,ft,ts,So,os,ns,as,me,is,G,pt,ss,te,rs,jt,ls,ds,ut,Eo,cs,fs,ps,he,us,ge,ms,_e,mt,hs,To,gs,_s,be,ht,bs,V,vs,jo,ys,xs,Io,ws,$s,Ao,Ds,Ps,Co,ks,Ss,Es,ve,gt,Ts,oe,js,Lo,Is,As,qo,Cs,Ls,Yo,z,_t,qs,Mo,Ms,Fs,bt,Ns,Fo,Os,Us,Vs,J,vt,zs,No,Ws,Gs,ye,Zo;return l=new il({}),De=new il({}),Re=new L({props:{name:"class diffusers.StableDiffusionPipeline",anchor:"diffusers.StableDiffusionPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModel"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"},{name:"safety_checker",val:": StableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"requires_safety_checker",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.StableDiffusionPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.16.0/en/api/models#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.StableDiffusionPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModel</code>) &#x2014;
Frozen text-encoder. Stable Diffusion uses the text portion of
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIP</a>, specifically
the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant.`,name:"text_encoder"},{anchor:"diffusers.StableDiffusionPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.StableDiffusionPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.16.0/en/api/models#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.StableDiffusionPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.16.0/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image latents. Can be one of
<a href="/docs/diffusers/v0.16.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.16.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.16.0/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.StableDiffusionPipeline.safety_checker",description:`<strong>safety_checker</strong> (<code>StableDiffusionSafetyChecker</code>) &#x2014;
Classification module that estimates whether generated images could be considered offensive or harmful.
Please, refer to the <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" rel="nofollow">model card</a> for details.`,name:"safety_checker"},{anchor:"diffusers.StableDiffusionPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<code>CLIPImageProcessor</code>) &#x2014;
Model that extracts features from generated images to be used as inputs for the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L56"}}),Qe=new L({props:{name:"__call__",anchor:"diffusers.StableDiffusionPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.StableDiffusionPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.StableDiffusionPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.StableDiffusionPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.StableDiffusionPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.StableDiffusionPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.StableDiffusionPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.StableDiffusionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.16.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.StableDiffusionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.StableDiffusionPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.StableDiffusionPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.StableDiffusionPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.StableDiffusionPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.StableDiffusionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.StableDiffusionPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.StableDiffusionPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.StableDiffusionPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/cross_attention.py" rel="nofollow">diffusers.cross_attention</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L530",returnDescription:`
<p><a
  href="/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),ae=new Ut({props:{anchor:"diffusers.StableDiffusionPipeline.__call__.example",$$slots:{default:[fl]},$$scope:{ctx:I}}}),Ye=new L({props:{name:"enable_attention_slicing",anchor:"diffusers.StableDiffusionPipeline.enable_attention_slicing",parameters:[{name:"slice_size",val:": typing.Union[str, int, NoneType] = 'auto'"}],parametersDescription:[{anchor:"diffusers.StableDiffusionPipeline.enable_attention_slicing.slice_size",description:`<strong>slice_size</strong> (<code>str</code> or <code>int</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
When <code>&quot;auto&quot;</code>, halves the input to the attention heads, so attention will be computed in two steps. If
<code>&quot;max&quot;</code>, maximum amount of memory will be saved by running only one slice at a time. If a number is
provided, uses as many slices as <code>attention_head_dim // slice_size</code>. In this case, <code>attention_head_dim</code>
must be a multiple of <code>slice_size</code>.`,name:"slice_size"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/pipeline_utils.py#L1476"}}),Ze=new L({props:{name:"disable_attention_slicing",anchor:"diffusers.StableDiffusionPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/pipeline_utils.py#L1492"}}),tt=new L({props:{name:"enable_vae_slicing",anchor:"diffusers.StableDiffusionPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L182"}}),ot=new L({props:{name:"disable_vae_slicing",anchor:"diffusers.StableDiffusionPipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L191"}}),at=new L({props:{name:"enable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionPipeline.enable_xformers_memory_efficient_attention",parameters:[{name:"attention_op",val:": typing.Optional[typing.Callable] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionPipeline.enable_xformers_memory_efficient_attention.attention_op",description:`<strong>attention_op</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
Override the default <code>None</code> operator for use as <code>op</code> argument to the
<a href="https://facebookresearch.github.io/xformers/components/ops.html#xformers.ops.memory_efficient_attention" rel="nofollow"><code>memory_efficient_attention()</code></a>
function of xFormers.`,name:"attention_op"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/pipeline_utils.py#L1418"}}),re=new Ut({props:{anchor:"diffusers.StableDiffusionPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[pl]},$$scope:{ctx:I}}}),it=new L({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionPipeline.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/pipeline_utils.py#L1450"}}),st=new L({props:{name:"enable_vae_tiling",anchor:"diffusers.StableDiffusionPipeline.enable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L198"}}),rt=new L({props:{name:"disable_vae_tiling",anchor:"diffusers.StableDiffusionPipeline.disable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L207"}}),dt=new L({props:{name:"load_textual_inversion",anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, typing.Dict[str, torch.Tensor]]"},{name:"token",val:": typing.Optional[str] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids should have an organization name, like
<code>&quot;sd-concepts-library/low-poly-hd-logos-icons&quot;</code>.</li>
<li>A path to a <em>directory</em> containing textual inversion weights, e.g.
<code>./my_text_inversion_directory/</code>.</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.weight_name",description:`<strong>weight_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Name of a custom weight file. This should be used in two cases:</p>
<ul>
<li>The saved textual inversion file is in <code>diffusers</code> format, but was saved under a specific weight
name, such as <code>text_inv.bin</code>.</li>
<li>The saved textual inversion file is in the &#x201C;Automatic1111&#x201D; form.</li>
</ul>`,name:"weight_name"},{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.`,name:"resume_download"},{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, e.g., <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to only look at local files (i.e., do not try to download the model).`,name:"local_files_only(bool,"},{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"use_auth_token"},{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"},{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
In case the relevant files are located inside a subfolder of the model repo (either remote in
huggingface.co or downloaded locally), you can specify the folder name here.`,name:"subfolder"},{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.mirror",description:`<strong>mirror</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Mirror source to accelerate downloads in China. If you are from China and have an accessibility
problem, you can set this option to resolve it. Note that we do not guarantee the timeliness or safety.
Please refer to the mirror site for more information.`,name:"mirror"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/loaders.py#L420"}}),ce=new Sn({props:{warning:!0,$$slots:{default:[ul]},$$scope:{ctx:I}}}),fe=new Sn({props:{$$slots:{default:[ml]},$$scope:{ctx:I}}}),pe=new Ut({props:{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.example",$$slots:{default:[hl]},$$scope:{ctx:I}}}),ue=new Ut({props:{anchor:"diffusers.StableDiffusionPipeline.load_textual_inversion.example-2",$$slots:{default:[gl]},$$scope:{ctx:I}}}),ct=new L({props:{name:"from_ckpt",anchor:"diffusers.StableDiffusionPipeline.from_ckpt",parameters:[{name:"pretrained_model_link_or_path",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.pretrained_model_link_or_path",description:`<strong>pretrained_model_link_or_path</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) &#x2014;
Can be either:<ul>
<li>A link to the .ckpt file on the Hub. Should be in the format
<code>&quot;https://huggingface.co/&lt;repo_id&gt;/blob/main/&lt;path_to_file&gt;&quot;</code></li>
<li>A path to a <em>file</em> containing all pipeline weights.</li>
</ul>`,name:"pretrained_model_link_or_path"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.torch_dtype",description:`<strong>torch_dtype</strong> (<code>str</code> or <code>torch.dtype</code>, <em>optional</em>) &#x2014;
Override the default <code>torch.dtype</code> and load the model under this dtype. If <code>&quot;auto&quot;</code> is passed the dtype
will be automatically derived from the model&#x2019;s weights.`,name:"torch_dtype"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.`,name:"resume_download"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, e.g., <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.local_files_only",description:`<strong>local_files_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to only look at local files (i.e., do not try to download the model).`,name:"local_files_only"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"use_auth_token"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.use_safetensors",description:`<strong>use_safetensors</strong> (<code>bool</code>, <em>optional</em> ) &#x2014;
If set to <code>True</code>, the pipeline will be loaded from <code>safetensors</code> weights. If set to <code>None</code> (the
default). The pipeline will load using <code>safetensors</code> if the safetensors weights are available <em>and</em> if
<code>safetensors</code> is installed. If the to <code>False</code> the pipeline will <em>not</em> use <code>safetensors</code>.`,name:"use_safetensors"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.extract_ema",description:`<strong>extract_ema</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014; Only relevant for
checkpoints that have both EMA and non-EMA weights. Whether to extract the EMA weights or not. Defaults
to <code>False</code>. Pass <code>True</code> to extract the EMA weights. EMA weights usually yield higher quality images for
inference. Non-EMA weights are usually better to continue fine-tuning.`,name:"extract_ema"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.upcast_attention",description:`<strong>upcast_attention</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Whether the attention computation should always be upcasted. This is necessary when running stable`,name:"upcast_attention"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The image size that the model was trained on. Use 512 for Stable Diffusion v1.X and Stable Diffusion v2
Base. Use 768 for Stable Diffusion v2.`,name:"image_size"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The prediction type that the model was trained on. Use <code>&apos;epsilon&apos;</code> for Stable Diffusion v1.X and Stable
Diffusion v2 Base. Use <code>&apos;v_prediction&apos;</code> for Stable Diffusion v2.`,name:"prediction_type"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.num_in_channels",description:`<strong>num_in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to None) &#x2014;
The number of input channels. If <code>None</code>, it will be automatically inferred.`,name:"num_in_channels"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.scheduler_type",description:`<strong>scheduler_type</strong> (<code>str</code>, <em>optional</em>, defaults to &#x2018;pndm&#x2019;) &#x2014;
Type of scheduler to use. Should be one of <code>[&quot;pndm&quot;, &quot;lms&quot;, &quot;heun&quot;, &quot;euler&quot;, &quot;euler-ancestral&quot;, &quot;dpm&quot;, &quot;ddim&quot;]</code>.`,name:"scheduler_type"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.load_safety_checker",description:`<strong>load_safety_checker</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to load the safety checker or not. Defaults to <code>True</code>.`,name:"load_safety_checker"},{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.kwargs",description:`<strong>kwargs</strong> (remaining dictionary of keyword arguments, <em>optional</em>) &#x2014;
Can be used to overwrite load - and saveable variables - <em>i.e.</em> the pipeline components - of the
specific pipeline class. The overwritten components are then directly passed to the pipelines
<code>__init__</code> method. See example below for more information.`,name:"kwargs"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/loaders.py#L1116"}}),me=new Ut({props:{anchor:"diffusers.StableDiffusionPipeline.from_ckpt.example",$$slots:{default:[_l]},$$scope:{ctx:I}}}),pt=new L({props:{name:"load_lora_weights",anchor:"diffusers.StableDiffusionPipeline.load_lora_weights",parameters:[{name:"pretrained_model_name_or_path_or_dict",val:": typing.Union[str, typing.Dict[str, torch.Tensor]]"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.StableDiffusionPipeline.load_lora_weights.pretrained_model_name_or_path_or_dict",description:`<strong>pretrained_model_name_or_path_or_dict</strong> (<code>str</code> or <code>os.PathLike</code> or <code>dict</code>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids should have an organization name, like <code>google/ddpm-celebahq-256</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using <code>~ModelMixin.save_config</code>, e.g.,
<code>./my_model_directory/</code>.</li>
<li>A <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html#what-is-a-state-dict" rel="nofollow">torch state
dict</a>.</li>
</ul>`,name:"pretrained_model_name_or_path_or_dict"},{anchor:"diffusers.StableDiffusionPipeline.load_lora_weights.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"diffusers.StableDiffusionPipeline.load_lora_weights.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.StableDiffusionPipeline.load_lora_weights.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.`,name:"resume_download"},{anchor:"diffusers.StableDiffusionPipeline.load_lora_weights.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, e.g., <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.StableDiffusionPipeline.load_lora_weights.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to only look at local files (i.e., do not try to download the model).`,name:"local_files_only(bool,"},{anchor:"diffusers.StableDiffusionPipeline.load_lora_weights.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"use_auth_token"},{anchor:"diffusers.StableDiffusionPipeline.load_lora_weights.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"},{anchor:"diffusers.StableDiffusionPipeline.load_lora_weights.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
In case the relevant files are located inside a subfolder of the model repo (either remote in
huggingface.co or downloaded locally), you can specify the folder name here.`,name:"subfolder"},{anchor:"diffusers.StableDiffusionPipeline.load_lora_weights.mirror",description:`<strong>mirror</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Mirror source to accelerate downloads in China. If you are from China and have an accessibility
problem, you can set this option to resolve it. Note that we do not guarantee the timeliness or safety.
Please refer to the mirror site for more information.`,name:"mirror"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/loaders.py#L678"}}),he=new Sn({props:{warning:!0,$$slots:{default:[bl]},$$scope:{ctx:I}}}),ge=new Sn({props:{$$slots:{default:[vl]},$$scope:{ctx:I}}}),mt=new L({props:{name:"save_lora_weights",anchor:"diffusers.StableDiffusionPipeline.save_lora_weights",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"unet_lora_layers",val:": typing.Dict[str, torch.nn.modules.module.Module] = None"},{name:"text_encoder_lora_layers",val:": typing.Dict[str, torch.nn.modules.module.Module] = None"},{name:"is_main_process",val:": bool = True"},{name:"weight_name",val:": str = None"},{name:"save_function",val:": typing.Callable = None"},{name:"safe_serialization",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.StableDiffusionPipeline.save_lora_weights.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to which to save. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"diffusers.StableDiffusionPipeline.save_lora_weights.unet_lora_layers",description:`<strong>unet_lora_layers</strong> (<code>Dict[str, torch.nn.Module</code>]) &#x2014;
State dict of the LoRA layers corresponding to the UNet. Specifying this helps to make the
serialization process easier and cleaner.`,name:"unet_lora_layers"},{anchor:"diffusers.StableDiffusionPipeline.save_lora_weights.text_encoder_lora_layers",description:`<strong>text_encoder_lora_layers</strong> (<code>Dict[str, torch.nn.Module</code>]) &#x2014;
State dict of the LoRA layers corresponding to the <code>text_encoder</code>. Since the <code>text_encoder</code> comes from
<code>transformers</code>, we cannot rejig it. That is why we have to explicitly pass the text encoder LoRA state
dict.`,name:"text_encoder_lora_layers"},{anchor:"diffusers.StableDiffusionPipeline.save_lora_weights.is_main_process",description:`<strong>is_main_process</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the process calling this is the main process or not. Useful when in distributed training like
TPUs and need to call this function on all processes. In this case, set <code>is_main_process=True</code> only on
the main process to avoid race conditions.`,name:"is_main_process"},{anchor:"diffusers.StableDiffusionPipeline.save_lora_weights.save_function",description:`<strong>save_function</strong> (<code>Callable</code>) &#x2014;
The function to use to save the state dictionary. Useful on distributed training like TPUs when one
need to replace <code>torch.save</code> by another method. Can be configured with the environment variable
<code>DIFFUSERS_SAVE_MODE</code>.`,name:"save_function"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/loaders.py#L1038"}}),ht=new L({props:{name:"enable_model_cpu_offload",anchor:"diffusers.StableDiffusionPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L239"}}),gt=new L({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.StableDiffusionPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L214"}}),_t=new L({props:{name:"class diffusers.FlaxStableDiffusionPipeline",anchor:"diffusers.FlaxStableDiffusionPipeline",parameters:[{name:"vae",val:": FlaxAutoencoderKL"},{name:"text_encoder",val:": FlaxCLIPTextModel"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"unet",val:": FlaxUNet2DConditionModel"},{name:"scheduler",val:": typing.Union[diffusers.schedulers.scheduling_ddim_flax.FlaxDDIMScheduler, diffusers.schedulers.scheduling_pndm_flax.FlaxPNDMScheduler, diffusers.schedulers.scheduling_lms_discrete_flax.FlaxLMSDiscreteScheduler, diffusers.schedulers.scheduling_dpmsolver_multistep_flax.FlaxDPMSolverMultistepScheduler]"},{name:"safety_checker",val:": FlaxStableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"}],parametersDescription:[{anchor:"diffusers.FlaxStableDiffusionPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.16.0/en/api/models#diffusers.FlaxAutoencoderKL">FlaxAutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.FlaxStableDiffusionPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>FlaxCLIPTextModel</code>) &#x2014;
Frozen text-encoder. Stable Diffusion uses the text portion of
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.FlaxCLIPTextModel" rel="nofollow">CLIP</a>,
specifically the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant.`,name:"text_encoder"},{anchor:"diffusers.FlaxStableDiffusionPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.FlaxStableDiffusionPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.16.0/en/api/models#diffusers.FlaxUNet2DConditionModel">FlaxUNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.FlaxStableDiffusionPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.16.0/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image latents. Can be one of
<code>FlaxDDIMScheduler</code>, <code>FlaxLMSDiscreteScheduler</code>, <code>FlaxPNDMScheduler</code>, or
<code>FlaxDPMSolverMultistepScheduler</code>.`,name:"scheduler"},{anchor:"diffusers.FlaxStableDiffusionPipeline.safety_checker",description:`<strong>safety_checker</strong> (<code>FlaxStableDiffusionSafetyChecker</code>) &#x2014;
Classification module that estimates whether generated images could be considered offensive or harmful.
Please, refer to the <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" rel="nofollow">model card</a> for details.`,name:"safety_checker"},{anchor:"diffusers.FlaxStableDiffusionPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<code>CLIPImageProcessor</code>) &#x2014;
Model that extracts features from generated images to be used as inputs for the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py#L81"}}),vt=new L({props:{name:"__call__",anchor:"diffusers.FlaxStableDiffusionPipeline.__call__",parameters:[{name:"prompt_ids",val:": array"},{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"prng_seed",val:": PRNGKeyArray"},{name:"num_inference_steps",val:": int = 50"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"guidance_scale",val:": typing.Union[float, array] = 7.5"},{name:"latents",val:": array = None"},{name:"neg_prompt_ids",val:": array = None"},{name:"return_dict",val:": bool = True"},{name:"jit",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.FlaxStableDiffusionPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.FlaxStableDiffusionPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.FlaxStableDiffusionPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.FlaxStableDiffusionPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.FlaxStableDiffusionPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.FlaxStableDiffusionPipeline.__call__.latents",description:`<strong>latents</strong> (<code>jnp.array</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. tensor will ge generated
by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.FlaxStableDiffusionPipeline.__call__.jit",description:`<strong>jit</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to run <code>pmap</code> versions of the generation and safety scoring functions. NOTE: This argument
exists because <code>__call__</code> is not yet end-to-end pmap-able. It will be removed in a future release.`,name:"jit"},{anchor:"diffusers.FlaxStableDiffusionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>FlaxStableDiffusionPipelineOutput</code> instead of
a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py#L311",returnDescription:`
<p><code>FlaxStableDiffusionPipelineOutput</code> if <code>return_dict</code> is True, otherwise a
<code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><code>FlaxStableDiffusionPipelineOutput</code> or <code>tuple</code></p>
`}}),ye=new Ut({props:{anchor:"diffusers.FlaxStableDiffusionPipeline.__call__.example",$$slots:{default:[yl]},$$scope:{ctx:I}}}),{c(){d=o("meta"),b=c(),p=o("h1"),m=o("a"),x=o("span"),$(l.$$.fragment),h=c(),j=o("span"),_=i("Text-to-Image Generation"),w=c(),A=o("h2"),O=o("a"),Wt=o("span"),$(De.$$.fragment),En=c(),Gt=o("span"),Tn=i("StableDiffusionPipeline"),Ko=c(),q=o("p"),jn=i("The Stable Diffusion model was created by the researchers and engineers from "),Pe=o("a"),In=i("CompVis"),An=i(", "),ke=o("a"),Cn=i("Stability AI"),Ln=i(", "),Se=o("a"),qn=i("runway"),Mn=i(", and "),Ee=o("a"),Fn=i("LAION"),Nn=i(". The "),wt=o("a"),On=i("StableDiffusionPipeline"),Un=i(" is capable of generating photo-realistic images given any text input using Stable Diffusion."),Bo=c(),$t=o("p"),Vn=i("The original codebase can be found here:"),Ho=c(),ne=o("ul"),Te=o("li"),Rt=o("em"),zn=i("Stable Diffusion V1"),Wn=i(": "),je=o("a"),Gn=i("CompVis/stable-diffusion"),Rn=c(),Ie=o("li"),Kt=o("em"),Kn=i("Stable Diffusion v2"),Bn=i(": "),Ae=o("a"),Hn=i("Stability-AI/stablediffusion"),Xo=c(),Dt=o("p"),Xn=i("Available Checkpoints are:"),Jo=c(),M=o("ul"),Ce=o("li"),Bt=o("em"),Jn=i("stable-diffusion-v1-4 (512x512 resolution)"),Qn=c(),Le=o("a"),Yn=i("CompVis/stable-diffusion-v1-4"),Zn=c(),qe=o("li"),Ht=o("em"),ea=i("stable-diffusion-v1-5 (512x512 resolution)"),ta=c(),Me=o("a"),oa=i("runwayml/stable-diffusion-v1-5"),na=c(),Fe=o("li"),Xt=o("em"),aa=i("stable-diffusion-2-base (512x512 resolution)"),ia=i(": "),Ne=o("a"),sa=i("stabilityai/stable-diffusion-2-base"),ra=c(),Oe=o("li"),Jt=o("em"),la=i("stable-diffusion-2 (768x768 resolution)"),da=i(": "),Ue=o("a"),ca=i("stabilityai/stable-diffusion-2"),fa=c(),Ve=o("li"),Qt=o("em"),pa=i("stable-diffusion-2-1-base (512x512 resolution)"),ua=c(),ze=o("a"),ma=i("stabilityai/stable-diffusion-2-1-base"),ha=c(),We=o("li"),Yt=o("em"),ga=i("stable-diffusion-2-1 (768x768 resolution)"),_a=i(": "),Ge=o("a"),ba=i("stabilityai/stable-diffusion-2-1"),Qo=c(),g=o("div"),$(Re.$$.fragment),va=c(),Zt=o("p"),ya=i("Pipeline for text-to-image generation using Stable Diffusion."),xa=c(),Ke=o("p"),wa=i("This model inherits from "),Pt=o("a"),$a=i("DiffusionPipeline"),Da=i(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Pa=c(),eo=o("p"),ka=i("In addition the pipeline inherits the following loading methods:"),Sa=c(),Z=o("ul"),Be=o("li"),to=o("em"),Ea=i("Textual-Inversion"),Ta=i(": "),kt=o("a"),ja=i("loaders.TextualInversionLoaderMixin.load_textual_inversion()"),Ia=c(),He=o("li"),oo=o("em"),Aa=i("LoRA"),Ca=i(": "),St=o("a"),La=i("loaders.LoraLoaderMixin.load_lora_weights()"),qa=c(),Xe=o("li"),no=o("em"),Ma=i("Ckpt"),Fa=i(": "),Et=o("a"),Na=i("loaders.FromCkptMixin.from_ckpt()"),Oa=c(),ao=o("p"),Ua=i("as well as the following saving methods:"),Va=c(),io=o("ul"),Je=o("li"),so=o("em"),za=i("LoRA"),Wa=i(": "),Tt=o("a"),Ga=i("loaders.LoraLoaderMixin.save_lora_weights()"),Ra=c(),K=o("div"),$(Qe.$$.fragment),Ka=c(),ro=o("p"),Ba=i("Function invoked when calling the pipeline for generation."),Ha=c(),$(ae.$$.fragment),Xa=c(),B=o("div"),$(Ye.$$.fragment),Ja=c(),lo=o("p"),Qa=i("Enable sliced attention computation."),Ya=c(),co=o("p"),Za=i(`When this option is enabled, the attention module will split the input tensor in slices, to compute attention
in several steps. This is useful to save some memory in exchange for a small speed decrease.`),ei=c(),ie=o("div"),$(Ze.$$.fragment),ti=c(),et=o("p"),oi=i("Disable sliced attention computation. If "),fo=o("code"),ni=i("enable_attention_slicing"),ai=i(` was previously invoked, this method will go
back to computing attention in one step.`),ii=c(),H=o("div"),$(tt.$$.fragment),si=c(),po=o("p"),ri=i("Enable sliced VAE decoding."),li=c(),uo=o("p"),di=i(`When this option is enabled, the VAE will split the input tensor in slices to compute decoding in several
steps. This is useful to save some memory and allow larger batch sizes.`),ci=c(),se=o("div"),$(ot.$$.fragment),fi=c(),nt=o("p"),pi=i("Disable sliced VAE decoding. If "),mo=o("code"),ui=i("enable_vae_slicing"),mi=i(` was previously invoked, this method will go back to
computing decoding in one step.`),hi=c(),U=o("div"),$(at.$$.fragment),gi=c(),ho=o("p"),_i=i("Enable memory efficient attention as implemented in xformers."),bi=c(),go=o("p"),vi=i(`When this option is enabled, you should observe lower GPU memory usage and a potential speed up at inference
time. Speed up at training time is not guaranteed.`),yi=c(),_o=o("p"),xi=i(`Warning: When Memory Efficient Attention and Sliced attention are both enabled, the Memory Efficient Attention
is used.`),wi=c(),$(re.$$.fragment),$i=c(),le=o("div"),$(it.$$.fragment),Di=c(),bo=o("p"),Pi=i("Disable memory efficient attention as implemented in xformers."),ki=c(),X=o("div"),$(st.$$.fragment),Si=c(),vo=o("p"),Ei=i("Enable tiled VAE decoding."),Ti=c(),yo=o("p"),ji=i(`When this option is enabled, the VAE will split the input tensor into tiles to compute decoding and encoding in
several steps. This is useful to save a large amount of memory and to allow the processing of larger images.`),Ii=c(),de=o("div"),$(rt.$$.fragment),Ai=c(),lt=o("p"),Ci=i("Disable tiled VAE decoding. If "),xo=o("code"),Li=i("enable_vae_tiling"),qi=i(` was previously invoked, this method will go back to
computing decoding in one step.`),Mi=c(),C=o("div"),$(dt.$$.fragment),Fi=c(),ee=o("p"),Ni=i("Load textual inversion embeddings into the text encoder of stable diffusion pipelines. Both "),wo=o("code"),Oi=i("diffusers"),Ui=i(` and
`),$o=o("code"),Vi=i("Automatic1111"),zi=i(" formats are supported (see example below)."),Wi=c(),$(ce.$$.fragment),Gi=c(),$(fe.$$.fragment),Ri=c(),Do=o("p"),Ki=i("Example:"),Bi=c(),$(pe.$$.fragment),Hi=c(),Po=o("p"),Xi=i("To load a textual inversion embedding vector in Automatic1111 format, make sure to first download the vector,"),Ji=c(),$(ue.$$.fragment),Qi=c(),W=o("div"),$(ct.$$.fragment),Yi=c(),ko=o("p"),Zi=i("Instantiate a PyTorch diffusion pipeline from pre-trained pipeline weights saved in the original .ckpt format."),es=c(),ft=o("p"),ts=i("The pipeline is set in evaluation mode by default using "),So=o("code"),os=i("model.eval()"),ns=i(" (Dropout modules are deactivated)."),as=c(),$(me.$$.fragment),is=c(),G=o("div"),$(pt.$$.fragment),ss=c(),te=o("p"),rs=i("Load pretrained attention processor layers (such as LoRA) into "),jt=o("a"),ls=i("UNet2DConditionModel"),ds=i(` and
`),ut=o("a"),Eo=o("code"),cs=i("CLIPTextModel"),fs=i(")."),ps=c(),$(he.$$.fragment),us=c(),$(ge.$$.fragment),ms=c(),_e=o("div"),$(mt.$$.fragment),hs=c(),To=o("p"),gs=i("Save the LoRA parameters corresponding to the UNet and the text encoder."),_s=c(),be=o("div"),$(ht.$$.fragment),bs=c(),V=o("p"),vs=i(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),jo=o("code"),ys=i("enable_sequential_cpu_offload"),xs=i(", this method moves one whole model at a time to the GPU when its "),Io=o("code"),ws=i("forward"),$s=i(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Ao=o("code"),Ds=i("enable_sequential_cpu_offload"),Ps=i(", but performance is much better due to the iterative execution of the "),Co=o("code"),ks=i("unet"),Ss=i("."),Es=c(),ve=o("div"),$(gt.$$.fragment),Ts=c(),oe=o("p"),js=i(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),Lo=o("code"),Is=i("torch.device('meta') and loaded to GPU only when their specific submodule has its "),As=i("forward"),qo=o("code"),Cs=i("method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),Ls=i("enable_model_cpu_offload`, but performance is lower."),Yo=c(),z=o("div"),$(_t.$$.fragment),qs=c(),Mo=o("p"),Ms=i("Pipeline for text-to-image generation using Stable Diffusion."),Fs=c(),bt=o("p"),Ns=i("This model inherits from "),Fo=o("code"),Os=i("FlaxDiffusionPipeline"),Us=i(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Vs=c(),J=o("div"),$(vt.$$.fragment),zs=c(),No=o("p"),Ws=i("Function invoked when calling the pipeline for generation."),Gs=c(),$(ye.$$.fragment),this.h()},l(r){const y=dl('[data-svelte="svelte-1phssyn"]',document.head);d=n(y,"META",{name:!0,content:!0}),y.forEach(t),b=f(r),p=n(r,"H1",{class:!0});var yt=a(p);m=n(yt,"A",{id:!0,class:!0,href:!0});var Oo=a(m);x=n(Oo,"SPAN",{});var Uo=a(x);D(l.$$.fragment,Uo),Uo.forEach(t),Oo.forEach(t),h=f(yt),j=n(yt,"SPAN",{});var Vo=a(j);_=s(Vo,"Text-to-Image Generation"),Vo.forEach(t),yt.forEach(t),w=f(r),A=n(r,"H2",{class:!0});var xt=a(A);O=n(xt,"A",{id:!0,class:!0,href:!0});var zo=a(O);Wt=n(zo,"SPAN",{});var Wo=a(Wt);D(De.$$.fragment,Wo),Wo.forEach(t),zo.forEach(t),En=f(xt),Gt=n(xt,"SPAN",{});var Go=a(Gt);Tn=s(Go,"StableDiffusionPipeline"),Go.forEach(t),xt.forEach(t),Ko=f(r),q=n(r,"P",{});var N=a(q);jn=s(N,"The Stable Diffusion model was created by the researchers and engineers from "),Pe=n(N,"A",{href:!0,rel:!0});var Ro=a(Pe);In=s(Ro,"CompVis"),Ro.forEach(t),An=s(N,", "),ke=n(N,"A",{href:!0,rel:!0});var Rs=a(ke);Cn=s(Rs,"Stability AI"),Rs.forEach(t),Ln=s(N,", "),Se=n(N,"A",{href:!0,rel:!0});var Ks=a(Se);qn=s(Ks,"runway"),Ks.forEach(t),Mn=s(N,", and "),Ee=n(N,"A",{href:!0,rel:!0});var Bs=a(Ee);Fn=s(Bs,"LAION"),Bs.forEach(t),Nn=s(N,". The "),wt=n(N,"A",{href:!0});var Hs=a(wt);On=s(Hs,"StableDiffusionPipeline"),Hs.forEach(t),Un=s(N," is capable of generating photo-realistic images given any text input using Stable Diffusion."),N.forEach(t),Bo=f(r),$t=n(r,"P",{});var Xs=a($t);Vn=s(Xs,"The original codebase can be found here:"),Xs.forEach(t),Ho=f(r),ne=n(r,"UL",{});var en=a(ne);Te=n(en,"LI",{});var tn=a(Te);Rt=n(tn,"EM",{});var Js=a(Rt);zn=s(Js,"Stable Diffusion V1"),Js.forEach(t),Wn=s(tn,": "),je=n(tn,"A",{href:!0,rel:!0});var Qs=a(je);Gn=s(Qs,"CompVis/stable-diffusion"),Qs.forEach(t),tn.forEach(t),Rn=f(en),Ie=n(en,"LI",{});var on=a(Ie);Kt=n(on,"EM",{});var Ys=a(Kt);Kn=s(Ys,"Stable Diffusion v2"),Ys.forEach(t),Bn=s(on,": "),Ae=n(on,"A",{href:!0,rel:!0});var Zs=a(Ae);Hn=s(Zs,"Stability-AI/stablediffusion"),Zs.forEach(t),on.forEach(t),en.forEach(t),Xo=f(r),Dt=n(r,"P",{});var er=a(Dt);Xn=s(er,"Available Checkpoints are:"),er.forEach(t),Jo=f(r),M=n(r,"UL",{});var R=a(M);Ce=n(R,"LI",{});var nn=a(Ce);Bt=n(nn,"EM",{});var tr=a(Bt);Jn=s(tr,"stable-diffusion-v1-4 (512x512 resolution)"),tr.forEach(t),Qn=f(nn),Le=n(nn,"A",{href:!0,rel:!0});var or=a(Le);Yn=s(or,"CompVis/stable-diffusion-v1-4"),or.forEach(t),nn.forEach(t),Zn=f(R),qe=n(R,"LI",{});var an=a(qe);Ht=n(an,"EM",{});var nr=a(Ht);ea=s(nr,"stable-diffusion-v1-5 (512x512 resolution)"),nr.forEach(t),ta=f(an),Me=n(an,"A",{href:!0,rel:!0});var ar=a(Me);oa=s(ar,"runwayml/stable-diffusion-v1-5"),ar.forEach(t),an.forEach(t),na=f(R),Fe=n(R,"LI",{});var sn=a(Fe);Xt=n(sn,"EM",{});var ir=a(Xt);aa=s(ir,"stable-diffusion-2-base (512x512 resolution)"),ir.forEach(t),ia=s(sn,": "),Ne=n(sn,"A",{href:!0,rel:!0});var sr=a(Ne);sa=s(sr,"stabilityai/stable-diffusion-2-base"),sr.forEach(t),sn.forEach(t),ra=f(R),Oe=n(R,"LI",{});var rn=a(Oe);Jt=n(rn,"EM",{});var rr=a(Jt);la=s(rr,"stable-diffusion-2 (768x768 resolution)"),rr.forEach(t),da=s(rn,": "),Ue=n(rn,"A",{href:!0,rel:!0});var lr=a(Ue);ca=s(lr,"stabilityai/stable-diffusion-2"),lr.forEach(t),rn.forEach(t),fa=f(R),Ve=n(R,"LI",{});var ln=a(Ve);Qt=n(ln,"EM",{});var dr=a(Qt);pa=s(dr,"stable-diffusion-2-1-base (512x512 resolution)"),dr.forEach(t),ua=f(ln),ze=n(ln,"A",{href:!0,rel:!0});var cr=a(ze);ma=s(cr,"stabilityai/stable-diffusion-2-1-base"),cr.forEach(t),ln.forEach(t),ha=f(R),We=n(R,"LI",{});var dn=a(We);Yt=n(dn,"EM",{});var fr=a(Yt);ga=s(fr,"stable-diffusion-2-1 (768x768 resolution)"),fr.forEach(t),_a=s(dn,": "),Ge=n(dn,"A",{href:!0,rel:!0});var pr=a(Ge);ba=s(pr,"stabilityai/stable-diffusion-2-1"),pr.forEach(t),dn.forEach(t),R.forEach(t),Qo=f(r),g=n(r,"DIV",{class:!0});var v=a(g);D(Re.$$.fragment,v),va=f(v),Zt=n(v,"P",{});var ur=a(Zt);ya=s(ur,"Pipeline for text-to-image generation using Stable Diffusion."),ur.forEach(t),xa=f(v),Ke=n(v,"P",{});var cn=a(Ke);wa=s(cn,"This model inherits from "),Pt=n(cn,"A",{href:!0});var mr=a(Pt);$a=s(mr,"DiffusionPipeline"),mr.forEach(t),Da=s(cn,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),cn.forEach(t),Pa=f(v),eo=n(v,"P",{});var hr=a(eo);ka=s(hr,"In addition the pipeline inherits the following loading methods:"),hr.forEach(t),Sa=f(v),Z=n(v,"UL",{});var It=a(Z);Be=n(It,"LI",{});var fn=a(Be);to=n(fn,"EM",{});var gr=a(to);Ea=s(gr,"Textual-Inversion"),gr.forEach(t),Ta=s(fn,": "),kt=n(fn,"A",{href:!0});var _r=a(kt);ja=s(_r,"loaders.TextualInversionLoaderMixin.load_textual_inversion()"),_r.forEach(t),fn.forEach(t),Ia=f(It),He=n(It,"LI",{});var pn=a(He);oo=n(pn,"EM",{});var br=a(oo);Aa=s(br,"LoRA"),br.forEach(t),Ca=s(pn,": "),St=n(pn,"A",{href:!0});var vr=a(St);La=s(vr,"loaders.LoraLoaderMixin.load_lora_weights()"),vr.forEach(t),pn.forEach(t),qa=f(It),Xe=n(It,"LI",{});var un=a(Xe);no=n(un,"EM",{});var yr=a(no);Ma=s(yr,"Ckpt"),yr.forEach(t),Fa=s(un,": "),Et=n(un,"A",{href:!0});var xr=a(Et);Na=s(xr,"loaders.FromCkptMixin.from_ckpt()"),xr.forEach(t),un.forEach(t),It.forEach(t),Oa=f(v),ao=n(v,"P",{});var wr=a(ao);Ua=s(wr,"as well as the following saving methods:"),wr.forEach(t),Va=f(v),io=n(v,"UL",{});var $r=a(io);Je=n($r,"LI",{});var mn=a(Je);so=n(mn,"EM",{});var Dr=a(so);za=s(Dr,"LoRA"),Dr.forEach(t),Wa=s(mn,": "),Tt=n(mn,"A",{href:!0});var Pr=a(Tt);Ga=s(Pr,"loaders.LoraLoaderMixin.save_lora_weights()"),Pr.forEach(t),mn.forEach(t),$r.forEach(t),Ra=f(v),K=n(v,"DIV",{class:!0});var At=a(K);D(Qe.$$.fragment,At),Ka=f(At),ro=n(At,"P",{});var kr=a(ro);Ba=s(kr,"Function invoked when calling the pipeline for generation."),kr.forEach(t),Ha=f(At),D(ae.$$.fragment,At),At.forEach(t),Xa=f(v),B=n(v,"DIV",{class:!0});var Ct=a(B);D(Ye.$$.fragment,Ct),Ja=f(Ct),lo=n(Ct,"P",{});var Sr=a(lo);Qa=s(Sr,"Enable sliced attention computation."),Sr.forEach(t),Ya=f(Ct),co=n(Ct,"P",{});var Er=a(co);Za=s(Er,`When this option is enabled, the attention module will split the input tensor in slices, to compute attention
in several steps. This is useful to save some memory in exchange for a small speed decrease.`),Er.forEach(t),Ct.forEach(t),ei=f(v),ie=n(v,"DIV",{class:!0});var hn=a(ie);D(Ze.$$.fragment,hn),ti=f(hn),et=n(hn,"P",{});var gn=a(et);oi=s(gn,"Disable sliced attention computation. If "),fo=n(gn,"CODE",{});var Tr=a(fo);ni=s(Tr,"enable_attention_slicing"),Tr.forEach(t),ai=s(gn,` was previously invoked, this method will go
back to computing attention in one step.`),gn.forEach(t),hn.forEach(t),ii=f(v),H=n(v,"DIV",{class:!0});var Lt=a(H);D(tt.$$.fragment,Lt),si=f(Lt),po=n(Lt,"P",{});var jr=a(po);ri=s(jr,"Enable sliced VAE decoding."),jr.forEach(t),li=f(Lt),uo=n(Lt,"P",{});var Ir=a(uo);di=s(Ir,`When this option is enabled, the VAE will split the input tensor in slices to compute decoding in several
steps. This is useful to save some memory and allow larger batch sizes.`),Ir.forEach(t),Lt.forEach(t),ci=f(v),se=n(v,"DIV",{class:!0});var _n=a(se);D(ot.$$.fragment,_n),fi=f(_n),nt=n(_n,"P",{});var bn=a(nt);pi=s(bn,"Disable sliced VAE decoding. If "),mo=n(bn,"CODE",{});var Ar=a(mo);ui=s(Ar,"enable_vae_slicing"),Ar.forEach(t),mi=s(bn,` was previously invoked, this method will go back to
computing decoding in one step.`),bn.forEach(t),_n.forEach(t),hi=f(v),U=n(v,"DIV",{class:!0});var Q=a(U);D(at.$$.fragment,Q),gi=f(Q),ho=n(Q,"P",{});var Cr=a(ho);_i=s(Cr,"Enable memory efficient attention as implemented in xformers."),Cr.forEach(t),bi=f(Q),go=n(Q,"P",{});var Lr=a(go);vi=s(Lr,`When this option is enabled, you should observe lower GPU memory usage and a potential speed up at inference
time. Speed up at training time is not guaranteed.`),Lr.forEach(t),yi=f(Q),_o=n(Q,"P",{});var qr=a(_o);xi=s(qr,`Warning: When Memory Efficient Attention and Sliced attention are both enabled, the Memory Efficient Attention
is used.`),qr.forEach(t),wi=f(Q),D(re.$$.fragment,Q),Q.forEach(t),$i=f(v),le=n(v,"DIV",{class:!0});var vn=a(le);D(it.$$.fragment,vn),Di=f(vn),bo=n(vn,"P",{});var Mr=a(bo);Pi=s(Mr,"Disable memory efficient attention as implemented in xformers."),Mr.forEach(t),vn.forEach(t),ki=f(v),X=n(v,"DIV",{class:!0});var qt=a(X);D(st.$$.fragment,qt),Si=f(qt),vo=n(qt,"P",{});var Fr=a(vo);Ei=s(Fr,"Enable tiled VAE decoding."),Fr.forEach(t),Ti=f(qt),yo=n(qt,"P",{});var Nr=a(yo);ji=s(Nr,`When this option is enabled, the VAE will split the input tensor into tiles to compute decoding and encoding in
several steps. This is useful to save a large amount of memory and to allow the processing of larger images.`),Nr.forEach(t),qt.forEach(t),Ii=f(v),de=n(v,"DIV",{class:!0});var yn=a(de);D(rt.$$.fragment,yn),Ai=f(yn),lt=n(yn,"P",{});var xn=a(lt);Ci=s(xn,"Disable tiled VAE decoding. If "),xo=n(xn,"CODE",{});var Or=a(xo);Li=s(Or,"enable_vae_tiling"),Or.forEach(t),qi=s(xn,` was previously invoked, this method will go back to
computing decoding in one step.`),xn.forEach(t),yn.forEach(t),Mi=f(v),C=n(v,"DIV",{class:!0});var F=a(C);D(dt.$$.fragment,F),Fi=f(F),ee=n(F,"P",{});var Mt=a(ee);Ni=s(Mt,"Load textual inversion embeddings into the text encoder of stable diffusion pipelines. Both "),wo=n(Mt,"CODE",{});var Ur=a(wo);Oi=s(Ur,"diffusers"),Ur.forEach(t),Ui=s(Mt,` and
`),$o=n(Mt,"CODE",{});var Vr=a($o);Vi=s(Vr,"Automatic1111"),Vr.forEach(t),zi=s(Mt," formats are supported (see example below)."),Mt.forEach(t),Wi=f(F),D(ce.$$.fragment,F),Gi=f(F),D(fe.$$.fragment,F),Ri=f(F),Do=n(F,"P",{});var zr=a(Do);Ki=s(zr,"Example:"),zr.forEach(t),Bi=f(F),D(pe.$$.fragment,F),Hi=f(F),Po=n(F,"P",{});var Wr=a(Po);Xi=s(Wr,"To load a textual inversion embedding vector in Automatic1111 format, make sure to first download the vector,"),Wr.forEach(t),Ji=f(F),D(ue.$$.fragment,F),F.forEach(t),Qi=f(v),W=n(v,"DIV",{class:!0});var xe=a(W);D(ct.$$.fragment,xe),Yi=f(xe),ko=n(xe,"P",{});var Gr=a(ko);Zi=s(Gr,"Instantiate a PyTorch diffusion pipeline from pre-trained pipeline weights saved in the original .ckpt format."),Gr.forEach(t),es=f(xe),ft=n(xe,"P",{});var wn=a(ft);ts=s(wn,"The pipeline is set in evaluation mode by default using "),So=n(wn,"CODE",{});var Rr=a(So);os=s(Rr,"model.eval()"),Rr.forEach(t),ns=s(wn," (Dropout modules are deactivated)."),wn.forEach(t),as=f(xe),D(me.$$.fragment,xe),xe.forEach(t),is=f(v),G=n(v,"DIV",{class:!0});var we=a(G);D(pt.$$.fragment,we),ss=f(we),te=n(we,"P",{});var Ft=a(te);rs=s(Ft,"Load pretrained attention processor layers (such as LoRA) into "),jt=n(Ft,"A",{href:!0});var Kr=a(jt);ls=s(Kr,"UNet2DConditionModel"),Kr.forEach(t),ds=s(Ft,` and
`),ut=n(Ft,"A",{href:!0,rel:!0});var Br=a(ut);Eo=n(Br,"CODE",{});var Hr=a(Eo);cs=s(Hr,"CLIPTextModel"),Hr.forEach(t),Br.forEach(t),fs=s(Ft,")."),Ft.forEach(t),ps=f(we),D(he.$$.fragment,we),us=f(we),D(ge.$$.fragment,we),we.forEach(t),ms=f(v),_e=n(v,"DIV",{class:!0});var $n=a(_e);D(mt.$$.fragment,$n),hs=f($n),To=n($n,"P",{});var Xr=a(To);gs=s(Xr,"Save the LoRA parameters corresponding to the UNet and the text encoder."),Xr.forEach(t),$n.forEach(t),_s=f(v),be=n(v,"DIV",{class:!0});var Dn=a(be);D(ht.$$.fragment,Dn),bs=f(Dn),V=n(Dn,"P",{});var Y=a(V);vs=s(Y,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),jo=n(Y,"CODE",{});var Jr=a(jo);ys=s(Jr,"enable_sequential_cpu_offload"),Jr.forEach(t),xs=s(Y,", this method moves one whole model at a time to the GPU when its "),Io=n(Y,"CODE",{});var Qr=a(Io);ws=s(Qr,"forward"),Qr.forEach(t),$s=s(Y,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Ao=n(Y,"CODE",{});var Yr=a(Ao);Ds=s(Yr,"enable_sequential_cpu_offload"),Yr.forEach(t),Ps=s(Y,", but performance is much better due to the iterative execution of the "),Co=n(Y,"CODE",{});var Zr=a(Co);ks=s(Zr,"unet"),Zr.forEach(t),Ss=s(Y,"."),Y.forEach(t),Dn.forEach(t),Es=f(v),ve=n(v,"DIV",{class:!0});var Pn=a(ve);D(gt.$$.fragment,Pn),Ts=f(Pn),oe=n(Pn,"P",{});var Nt=a(oe);js=s(Nt,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),Lo=n(Nt,"CODE",{});var el=a(Lo);Is=s(el,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),el.forEach(t),As=s(Nt,"forward"),qo=n(Nt,"CODE",{});var tl=a(qo);Cs=s(tl,"method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),tl.forEach(t),Ls=s(Nt,"enable_model_cpu_offload`, but performance is lower."),Nt.forEach(t),Pn.forEach(t),v.forEach(t),Yo=f(r),z=n(r,"DIV",{class:!0});var $e=a(z);D(_t.$$.fragment,$e),qs=f($e),Mo=n($e,"P",{});var ol=a(Mo);Ms=s(ol,"Pipeline for text-to-image generation using Stable Diffusion."),ol.forEach(t),Fs=f($e),bt=n($e,"P",{});var kn=a(bt);Ns=s(kn,"This model inherits from "),Fo=n(kn,"CODE",{});var nl=a(Fo);Os=s(nl,"FlaxDiffusionPipeline"),nl.forEach(t),Us=s(kn,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),kn.forEach(t),Vs=f($e),J=n($e,"DIV",{class:!0});var Ot=a(J);D(vt.$$.fragment,Ot),zs=f(Ot),No=n(Ot,"P",{});var al=a(No);Ws=s(al,"Function invoked when calling the pipeline for generation."),al.forEach(t),Gs=f(Ot),D(ye.$$.fragment,Ot),Ot.forEach(t),$e.forEach(t),this.h()},h(){u(d,"name","hf:doc:metadata"),u(d,"content",JSON.stringify(wl)),u(m,"id","texttoimage-generation"),u(m,"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"),u(m,"href","#texttoimage-generation"),u(p,"class","relative group"),u(O,"id","diffusers.StableDiffusionPipeline"),u(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"),u(O,"href","#diffusers.StableDiffusionPipeline"),u(A,"class","relative group"),u(Pe,"href","https://github.com/CompVis"),u(Pe,"rel","nofollow"),u(ke,"href","https://stability.ai/"),u(ke,"rel","nofollow"),u(Se,"href","https://github.com/runwayml"),u(Se,"rel","nofollow"),u(Ee,"href","https://laion.ai/"),u(Ee,"rel","nofollow"),u(wt,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),u(je,"href","https://github.com/CompVis/stable-diffusion"),u(je,"rel","nofollow"),u(Ae,"href","https://github.com/Stability-AI/stablediffusion"),u(Ae,"rel","nofollow"),u(Le,"href","https://huggingface.co/CompVis/stable-diffusion-v1-4"),u(Le,"rel","nofollow"),u(Me,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),u(Me,"rel","nofollow"),u(Ne,"href","https://huggingface.co/stabilityai/stable-diffusion-2-base"),u(Ne,"rel","nofollow"),u(Ue,"href","https://huggingface.co/stabilityai/stable-diffusion-2"),u(Ue,"rel","nofollow"),u(ze,"href","https://huggingface.co/stabilityai/stable-diffusion-2-1-base"),u(ze,"rel","nofollow"),u(Ge,"href","https://huggingface.co/stabilityai/stable-diffusion-2-1"),u(Ge,"rel","nofollow"),u(Pt,"href","/docs/diffusers/v0.16.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),u(kt,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/inpaint#diffusers.StableDiffusionInpaintPipeline.load_textual_inversion"),u(St,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/inpaint#diffusers.StableDiffusionInpaintPipeline.load_lora_weights"),u(Et,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.from_ckpt"),u(Tt,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/inpaint#diffusers.StableDiffusionInpaintPipeline.save_lora_weights"),u(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(jt,"href","/docs/diffusers/v0.16.0/en/api/models#diffusers.UNet2DConditionModel"),u(ut,"href","https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel"),u(ut,"rel","nofollow"),u(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(g,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(r,y){e(document.head,d),T(r,b,y),T(r,p,y),e(p,m),e(m,x),P(l,x,null),e(p,h),e(p,j),e(j,_),T(r,w,y),T(r,A,y),e(A,O),e(O,Wt),P(De,Wt,null),e(A,En),e(A,Gt),e(Gt,Tn),T(r,Ko,y),T(r,q,y),e(q,jn),e(q,Pe),e(Pe,In),e(q,An),e(q,ke),e(ke,Cn),e(q,Ln),e(q,Se),e(Se,qn),e(q,Mn),e(q,Ee),e(Ee,Fn),e(q,Nn),e(q,wt),e(wt,On),e(q,Un),T(r,Bo,y),T(r,$t,y),e($t,Vn),T(r,Ho,y),T(r,ne,y),e(ne,Te),e(Te,Rt),e(Rt,zn),e(Te,Wn),e(Te,je),e(je,Gn),e(ne,Rn),e(ne,Ie),e(Ie,Kt),e(Kt,Kn),e(Ie,Bn),e(Ie,Ae),e(Ae,Hn),T(r,Xo,y),T(r,Dt,y),e(Dt,Xn),T(r,Jo,y),T(r,M,y),e(M,Ce),e(Ce,Bt),e(Bt,Jn),e(Ce,Qn),e(Ce,Le),e(Le,Yn),e(M,Zn),e(M,qe),e(qe,Ht),e(Ht,ea),e(qe,ta),e(qe,Me),e(Me,oa),e(M,na),e(M,Fe),e(Fe,Xt),e(Xt,aa),e(Fe,ia),e(Fe,Ne),e(Ne,sa),e(M,ra),e(M,Oe),e(Oe,Jt),e(Jt,la),e(Oe,da),e(Oe,Ue),e(Ue,ca),e(M,fa),e(M,Ve),e(Ve,Qt),e(Qt,pa),e(Ve,ua),e(Ve,ze),e(ze,ma),e(M,ha),e(M,We),e(We,Yt),e(Yt,ga),e(We,_a),e(We,Ge),e(Ge,ba),T(r,Qo,y),T(r,g,y),P(Re,g,null),e(g,va),e(g,Zt),e(Zt,ya),e(g,xa),e(g,Ke),e(Ke,wa),e(Ke,Pt),e(Pt,$a),e(Ke,Da),e(g,Pa),e(g,eo),e(eo,ka),e(g,Sa),e(g,Z),e(Z,Be),e(Be,to),e(to,Ea),e(Be,Ta),e(Be,kt),e(kt,ja),e(Z,Ia),e(Z,He),e(He,oo),e(oo,Aa),e(He,Ca),e(He,St),e(St,La),e(Z,qa),e(Z,Xe),e(Xe,no),e(no,Ma),e(Xe,Fa),e(Xe,Et),e(Et,Na),e(g,Oa),e(g,ao),e(ao,Ua),e(g,Va),e(g,io),e(io,Je),e(Je,so),e(so,za),e(Je,Wa),e(Je,Tt),e(Tt,Ga),e(g,Ra),e(g,K),P(Qe,K,null),e(K,Ka),e(K,ro),e(ro,Ba),e(K,Ha),P(ae,K,null),e(g,Xa),e(g,B),P(Ye,B,null),e(B,Ja),e(B,lo),e(lo,Qa),e(B,Ya),e(B,co),e(co,Za),e(g,ei),e(g,ie),P(Ze,ie,null),e(ie,ti),e(ie,et),e(et,oi),e(et,fo),e(fo,ni),e(et,ai),e(g,ii),e(g,H),P(tt,H,null),e(H,si),e(H,po),e(po,ri),e(H,li),e(H,uo),e(uo,di),e(g,ci),e(g,se),P(ot,se,null),e(se,fi),e(se,nt),e(nt,pi),e(nt,mo),e(mo,ui),e(nt,mi),e(g,hi),e(g,U),P(at,U,null),e(U,gi),e(U,ho),e(ho,_i),e(U,bi),e(U,go),e(go,vi),e(U,yi),e(U,_o),e(_o,xi),e(U,wi),P(re,U,null),e(g,$i),e(g,le),P(it,le,null),e(le,Di),e(le,bo),e(bo,Pi),e(g,ki),e(g,X),P(st,X,null),e(X,Si),e(X,vo),e(vo,Ei),e(X,Ti),e(X,yo),e(yo,ji),e(g,Ii),e(g,de),P(rt,de,null),e(de,Ai),e(de,lt),e(lt,Ci),e(lt,xo),e(xo,Li),e(lt,qi),e(g,Mi),e(g,C),P(dt,C,null),e(C,Fi),e(C,ee),e(ee,Ni),e(ee,wo),e(wo,Oi),e(ee,Ui),e(ee,$o),e($o,Vi),e(ee,zi),e(C,Wi),P(ce,C,null),e(C,Gi),P(fe,C,null),e(C,Ri),e(C,Do),e(Do,Ki),e(C,Bi),P(pe,C,null),e(C,Hi),e(C,Po),e(Po,Xi),e(C,Ji),P(ue,C,null),e(g,Qi),e(g,W),P(ct,W,null),e(W,Yi),e(W,ko),e(ko,Zi),e(W,es),e(W,ft),e(ft,ts),e(ft,So),e(So,os),e(ft,ns),e(W,as),P(me,W,null),e(g,is),e(g,G),P(pt,G,null),e(G,ss),e(G,te),e(te,rs),e(te,jt),e(jt,ls),e(te,ds),e(te,ut),e(ut,Eo),e(Eo,cs),e(te,fs),e(G,ps),P(he,G,null),e(G,us),P(ge,G,null),e(g,ms),e(g,_e),P(mt,_e,null),e(_e,hs),e(_e,To),e(To,gs),e(g,_s),e(g,be),P(ht,be,null),e(be,bs),e(be,V),e(V,vs),e(V,jo),e(jo,ys),e(V,xs),e(V,Io),e(Io,ws),e(V,$s),e(V,Ao),e(Ao,Ds),e(V,Ps),e(V,Co),e(Co,ks),e(V,Ss),e(g,Es),e(g,ve),P(gt,ve,null),e(ve,Ts),e(ve,oe),e(oe,js),e(oe,Lo),e(Lo,Is),e(oe,As),e(oe,qo),e(qo,Cs),e(oe,Ls),T(r,Yo,y),T(r,z,y),P(_t,z,null),e(z,qs),e(z,Mo),e(Mo,Ms),e(z,Fs),e(z,bt),e(bt,Ns),e(bt,Fo),e(Fo,Os),e(bt,Us),e(z,Vs),e(z,J),P(vt,J,null),e(J,zs),e(J,No),e(No,Ws),e(J,Gs),P(ye,J,null),Zo=!0},p(r,[y]){const yt={};y&2&&(yt.$$scope={dirty:y,ctx:r}),ae.$set(yt);const Oo={};y&2&&(Oo.$$scope={dirty:y,ctx:r}),re.$set(Oo);const Uo={};y&2&&(Uo.$$scope={dirty:y,ctx:r}),ce.$set(Uo);const Vo={};y&2&&(Vo.$$scope={dirty:y,ctx:r}),fe.$set(Vo);const xt={};y&2&&(xt.$$scope={dirty:y,ctx:r}),pe.$set(xt);const zo={};y&2&&(zo.$$scope={dirty:y,ctx:r}),ue.$set(zo);const Wo={};y&2&&(Wo.$$scope={dirty:y,ctx:r}),me.$set(Wo);const Go={};y&2&&(Go.$$scope={dirty:y,ctx:r}),he.$set(Go);const N={};y&2&&(N.$$scope={dirty:y,ctx:r}),ge.$set(N);const Ro={};y&2&&(Ro.$$scope={dirty:y,ctx:r}),ye.$set(Ro)},i(r){Zo||(k(l.$$.fragment,r),k(De.$$.fragment,r),k(Re.$$.fragment,r),k(Qe.$$.fragment,r),k(ae.$$.fragment,r),k(Ye.$$.fragment,r),k(Ze.$$.fragment,r),k(tt.$$.fragment,r),k(ot.$$.fragment,r),k(at.$$.fragment,r),k(re.$$.fragment,r),k(it.$$.fragment,r),k(st.$$.fragment,r),k(rt.$$.fragment,r),k(dt.$$.fragment,r),k(ce.$$.fragment,r),k(fe.$$.fragment,r),k(pe.$$.fragment,r),k(ue.$$.fragment,r),k(ct.$$.fragment,r),k(me.$$.fragment,r),k(pt.$$.fragment,r),k(he.$$.fragment,r),k(ge.$$.fragment,r),k(mt.$$.fragment,r),k(ht.$$.fragment,r),k(gt.$$.fragment,r),k(_t.$$.fragment,r),k(vt.$$.fragment,r),k(ye.$$.fragment,r),Zo=!0)},o(r){S(l.$$.fragment,r),S(De.$$.fragment,r),S(Re.$$.fragment,r),S(Qe.$$.fragment,r),S(ae.$$.fragment,r),S(Ye.$$.fragment,r),S(Ze.$$.fragment,r),S(tt.$$.fragment,r),S(ot.$$.fragment,r),S(at.$$.fragment,r),S(re.$$.fragment,r),S(it.$$.fragment,r),S(st.$$.fragment,r),S(rt.$$.fragment,r),S(dt.$$.fragment,r),S(ce.$$.fragment,r),S(fe.$$.fragment,r),S(pe.$$.fragment,r),S(ue.$$.fragment,r),S(ct.$$.fragment,r),S(me.$$.fragment,r),S(pt.$$.fragment,r),S(he.$$.fragment,r),S(ge.$$.fragment,r),S(mt.$$.fragment,r),S(ht.$$.fragment,r),S(gt.$$.fragment,r),S(_t.$$.fragment,r),S(vt.$$.fragment,r),S(ye.$$.fragment,r),Zo=!1},d(r){t(d),r&&t(b),r&&t(p),E(l),r&&t(w),r&&t(A),E(De),r&&t(Ko),r&&t(q),r&&t(Bo),r&&t($t),r&&t(Ho),r&&t(ne),r&&t(Xo),r&&t(Dt),r&&t(Jo),r&&t(M),r&&t(Qo),r&&t(g),E(Re),E(Qe),E(ae),E(Ye),E(Ze),E(tt),E(ot),E(at),E(re),E(it),E(st),E(rt),E(dt),E(ce),E(fe),E(pe),E(ue),E(ct),E(me),E(pt),E(he),E(ge),E(mt),E(ht),E(gt),r&&t(Yo),r&&t(z),E(_t),E(vt),E(ye)}}}const wl={local:"texttoimage-generation",sections:[{local:"diffusers.StableDiffusionPipeline",title:"StableDiffusionPipeline"}],title:"Text-to-Image Generation"};function $l(I){return cl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class jl extends sl{constructor(d){super();rl(this,d,$l,xl,ll,{})}}export{jl as default,wl as metadata};
