import{S as hn,i as cn,s as dn,e as r,k as u,w as c,t as o,M as mn,c as l,d as s,m as f,a as i,x as d,h as p,b as h,N as Us,G as t,g as n,y as m,q as _,o as g,B as v,v as _n}from"../../chunks/vendor-hf-doc-builder.js";import{T as gn}from"../../chunks/Tip-hf-doc-builder.js";import{I as Ws}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as b}from"../../chunks/CodeBlock-hf-doc-builder.js";function vn(mt){let w,Z,S,j,U,P,x,q,W,ee,M,J,k,_e;return{c(){w=r("p"),Z=o("The following Flax schedulers are "),S=r("em"),j=o("not yet compatible"),U=o(" with the Flax Stable Diffusion Pipeline:"),P=u(),x=r("ul"),q=r("li"),W=r("code"),ee=o("FlaxLMSDiscreteScheduler"),M=u(),J=r("li"),k=r("code"),_e=o("FlaxDDPMScheduler")},l(y){w=l(y,"P",{});var E=i(w);Z=p(E,"The following Flax schedulers are "),S=l(E,"EM",{});var A=i(S);j=p(A,"not yet compatible"),A.forEach(s),U=p(E," with the Flax Stable Diffusion Pipeline:"),E.forEach(s),P=f(y),x=l(y,"UL",{});var se=i(x);q=l(se,"LI",{});var te=i(q);W=l(te,"CODE",{});var Je=i(W);ee=p(Je,"FlaxLMSDiscreteScheduler"),Je.forEach(s),te.forEach(s),M=f(se),J=l(se,"LI",{});var ze=i(J);k=l(ze,"CODE",{});var ge=i(k);_e=p(ge,"FlaxDDPMScheduler"),ge.forEach(s),ze.forEach(s),se.forEach(s)},m(y,E){n(y,w,E),t(w,Z),t(w,S),t(S,j),t(w,U),n(y,P,E),n(y,x,E),t(x,q),t(q,W),t(W,ee),t(x,M),t(x,J),t(J,k),t(k,_e)},d(y){y&&s(w),y&&s(P),y&&s(x)}}}function wn(mt){let w,Z,S,j,U,P,x,q,W,ee,M,J,k,_e,y,E,A,se,te,Je,ze,ge,G,Js,qr,Ar,zs,Nr,Ir,Xs,Fr,_t,R,Lr,Ks,Tr,Cr,Ys,Gr,Rr,gt,Xe,Or,vt,z,re,Qs,ve,Br,Vs,Hr,wt,le,Ur,we,Wr,Jr,$t,$e,bt,Ke,zr,St,be,yt,X,ae,Zs,Se,Xr,et,Kr,Dt,O,Yr,st,Qr,Vr,tt,Zr,el,Et,ye,jt,De,rt,sl,tl,Pt,Ee,xt,ie,rl,Ye,ll,al,Mt,je,kt,Qe,il,qt,Pe,At,N,nl,ol,Ve,ei,pl,ul,Nt,K,ne,lt,xe,fl,at,hl,It,oe,cl,it,dl,ml,Ft,Me,Lt,ke,nt,_l,gl,Tt,qe,Ct,Ze,vl,Gt,$,es,ss,wl,$l,bl,ts,rs,Sl,yl,Dl,ls,as,El,jl,Pl,is,ns,xl,Ml,kl,os,ps,ql,Al,Nl,us,fs,Il,Fl,Ll,hs,cs,Tl,Cl,Rt,B,Gl,ot,Rl,Ol,ds,Bl,Hl,Ot,Ae,Bt,ms,Ul,Ht,Ne,pt,Wl,Jl,Ut,Ie,Wt,pe,zl,_s,Xl,Kl,Jt,Fe,zt,gs,Yl,Xt,Le,Kt,I,Ql,Vl,vs,si,Zl,ea,Yt,ue,sa,ws,ta,ra,Qt,Y,fe,ut,Te,la,ft,aa,Vt,H,ia,$s,na,oa,bs,pa,ua,Zt,Ce,Ss,fa,ha,er,Ge,sr,F,ca,da,ys,ti,ma,_a,tr,Q,Ds,ga,va,Es,wa,$a,rr,Re,lr,L,ba,Sa,js,ri,ya,Da,ar,Ps,Ea,ir,Oe,nr,T,ja,Pa,xs,li,xa,Ma,or,he,ka,Ms,qa,Aa,pr,Be,ur,C,Na,Ia,ks,ai,Fa,La,fr,qs,Ta,hr,V,ce,ht,He,Ca,ct,Ga,cr,de,Ra,As,Oa,Ba,dr,Ue,mr,me,_r;return P=new Ws({}),ve=new Ws({}),$e=new b({props:{code:`from huggingface_hub import login
from diffusers import DiffusionPipeline
import torch

# first we need to login with our access token
login()

# Now we can download the pipeline
pipeline = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)`,highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> login
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

<span class="hljs-comment"># first we need to login with our access token</span>
login()

<span class="hljs-comment"># Now we can download the pipeline</span>
pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16)`}}),be=new b({props:{code:'pipeline.to("cuda")',highlighted:'pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)'}}),Se=new Ws({}),ye=new b({props:{code:"pipeline.scheduler",highlighted:"pipeline.scheduler"}}),Ee=new b({props:{code:`PNDMScheduler {
  "_class_name": "PNDMScheduler",
  "_diffusers_version": "0.8.0.dev0",
  "beta_end": 0.012,
  "beta_schedule": "scaled_linear",
  "beta_start": 0.00085,
  "clip_sample": false,
  "num_train_timesteps": 1000,
  "set_alpha_to_one": false,
  "skip_prk_steps": true,
  "steps_offset": 1,
  "trained_betas": null
}`,highlighted:`PNDMScheduler {
  <span class="hljs-string">&quot;_class_name&quot;</span>: <span class="hljs-string">&quot;PNDMScheduler&quot;</span>,
  <span class="hljs-string">&quot;_diffusers_version&quot;</span>: <span class="hljs-string">&quot;0.8.0.dev0&quot;</span>,
  <span class="hljs-string">&quot;beta_end&quot;</span>: <span class="hljs-number">0.012</span>,
  <span class="hljs-string">&quot;beta_schedule&quot;</span>: <span class="hljs-string">&quot;scaled_linear&quot;</span>,
  <span class="hljs-string">&quot;beta_start&quot;</span>: <span class="hljs-number">0.00085</span>,
  <span class="hljs-string">&quot;clip_sample&quot;</span>: <span class="hljs-literal">false</span>,
  <span class="hljs-string">&quot;num_train_timesteps&quot;</span>: <span class="hljs-number">1000</span>,
  <span class="hljs-string">&quot;set_alpha_to_one&quot;</span>: <span class="hljs-literal">false</span>,
  <span class="hljs-string">&quot;skip_prk_steps&quot;</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-string">&quot;steps_offset&quot;</span>: <span class="hljs-number">1</span>,
  <span class="hljs-string">&quot;trained_betas&quot;</span>: <span class="hljs-literal">null</span>
}`}}),je=new b({props:{code:'prompt = "A photograph of an astronaut riding a horse on Mars, high resolution, high definition."',highlighted:'prompt = <span class="hljs-string">&quot;A photograph of an astronaut riding a horse on Mars, high resolution, high definition.&quot;</span>'}}),Pe=new b({props:{code:`generator = torch.Generator(device="cuda").manual_seed(8)
image = pipeline(prompt, generator=generator).images[0]
image`,highlighted:`generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">8</span>)
image = pipeline(prompt, generator=generator).images[<span class="hljs-number">0</span>]
image`}}),xe=new Ws({}),Me=new b({props:{code:"pipeline.scheduler.compatibles",highlighted:"pipeline.scheduler.compatibles"}}),qe=new b({props:{code:`[diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteScheduler,
 diffusers.schedulers.scheduling_ddim.DDIMScheduler,
 diffusers.schedulers.scheduling_dpmsolver_multistep.DPMSolverMultistepScheduler,
 diffusers.schedulers.scheduling_euler_discrete.EulerDiscreteScheduler,
 diffusers.schedulers.scheduling_pndm.PNDMScheduler,
 diffusers.schedulers.scheduling_ddpm.DDPMScheduler,
 diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteScheduler]`,highlighted:`[<span class="hljs-keyword">diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteScheduler,
</span> <span class="hljs-keyword">diffusers.schedulers.scheduling_ddim.DDIMScheduler,
</span> <span class="hljs-keyword">diffusers.schedulers.scheduling_dpmsolver_multistep.DPMSolverMultistepScheduler,
</span> <span class="hljs-keyword">diffusers.schedulers.scheduling_euler_discrete.EulerDiscreteScheduler,
</span> <span class="hljs-keyword">diffusers.schedulers.scheduling_pndm.PNDMScheduler,
</span> <span class="hljs-keyword">diffusers.schedulers.scheduling_ddpm.DDPMScheduler,
</span> <span class="hljs-keyword">diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteScheduler]</span>`}}),Ae=new b({props:{code:"pipeline.scheduler.config",highlighted:"pipeline.scheduler.config"}}),Ie=new b({props:{code:`FrozenDict([('num_train_timesteps', 1000),
            ('beta_start', 0.00085),
            ('beta_end', 0.012),
            ('beta_schedule', 'scaled_linear'),
            ('trained_betas', None),
            ('skip_prk_steps', True),
            ('set_alpha_to_one', False),
            ('steps_offset', 1),
            ('_class_name', 'PNDMScheduler'),
            ('_diffusers_version', '0.8.0.dev0'),
            ('clip_sample', False)])`,highlighted:`FrozenDict([(&#x27;num_train_timesteps&#x27;, <span class="hljs-number">1000</span>),
            (&#x27;beta_start&#x27;, <span class="hljs-number">0.00085</span>),
            (&#x27;beta_end&#x27;, <span class="hljs-number">0.012</span>),
            (&#x27;beta_schedule&#x27;, &#x27;scaled_linear&#x27;),
            (&#x27;trained_betas&#x27;, None),
            (&#x27;skip_prk_steps&#x27;, True),
            (&#x27;set_alpha_to_one&#x27;, False),
            (&#x27;steps_offset&#x27;, <span class="hljs-number">1</span>),
            (&#x27;_class_name&#x27;, &#x27;PNDMScheduler&#x27;),
            (&#x27;_diffusers_version&#x27;, &#x27;<span class="hljs-number">0.8</span>.<span class="hljs-number">0</span>.dev0&#x27;),
            (&#x27;clip_sample&#x27;, False)])`}}),Fe=new b({props:{code:`from diffusers import DDIMScheduler

pipeline.scheduler = DDIMScheduler.from_config(pipeline.scheduler.config)`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DDIMScheduler

pipeline.scheduler = DDIMScheduler.from_config(pipeline.scheduler.config)`}}),Le=new b({props:{code:`generator = torch.Generator(device="cuda").manual_seed(8)
image = pipeline(prompt, generator=generator).images[0]
image`,highlighted:`generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">8</span>)
image = pipeline(prompt, generator=generator).images[<span class="hljs-number">0</span>]
image`}}),Te=new Ws({}),Ge=new b({props:{code:`from diffusers import LMSDiscreteScheduler

pipeline.scheduler = LMSDiscreteScheduler.from_config(pipeline.scheduler.config)

generator = torch.Generator(device="cuda").manual_seed(8)
image = pipeline(prompt, generator=generator).images[0]
image`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> LMSDiscreteScheduler

pipeline.scheduler = LMSDiscreteScheduler.from_config(pipeline.scheduler.config)

generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">8</span>)
image = pipeline(prompt, generator=generator).images[<span class="hljs-number">0</span>]
image`}}),Re=new b({props:{code:`from diffusers import EulerDiscreteScheduler

pipeline.scheduler = EulerDiscreteScheduler.from_config(pipeline.scheduler.config)

generator = torch.Generator(device="cuda").manual_seed(8)
image = pipeline(prompt, generator=generator, num_inference_steps=30).images[0]
image`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> EulerDiscreteScheduler

pipeline.scheduler = EulerDiscreteScheduler.from_config(pipeline.scheduler.config)

generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">8</span>)
image = pipeline(prompt, generator=generator, num_inference_steps=<span class="hljs-number">30</span>).images[<span class="hljs-number">0</span>]
image`}}),Oe=new b({props:{code:`from diffusers import EulerAncestralDiscreteScheduler

pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(pipeline.scheduler.config)

generator = torch.Generator(device="cuda").manual_seed(8)
image = pipeline(prompt, generator=generator, num_inference_steps=30).images[0]
image`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> EulerAncestralDiscreteScheduler

pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(pipeline.scheduler.config)

generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">8</span>)
image = pipeline(prompt, generator=generator, num_inference_steps=<span class="hljs-number">30</span>).images[<span class="hljs-number">0</span>]
image`}}),Be=new b({props:{code:`from diffusers import DPMSolverMultistepScheduler

pipeline.scheduler = DPMSolverMultistepScheduler.from_config(pipeline.scheduler.config)

generator = torch.Generator(device="cuda").manual_seed(8)
image = pipeline(prompt, generator=generator, num_inference_steps=20).images[0]
image`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DPMSolverMultistepScheduler

pipeline.scheduler = DPMSolverMultistepScheduler.from_config(pipeline.scheduler.config)

generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">8</span>)
image = pipeline(prompt, generator=generator, num_inference_steps=<span class="hljs-number">20</span>).images[<span class="hljs-number">0</span>]
image`}}),He=new Ws({}),Ue=new b({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, FlaxDPMSolverMultistepScheduler

model_id = "runwayml/stable-diffusion-v1-5"
scheduler, scheduler_state = FlaxDPMSolverMultistepScheduler.from_pretrained(
    model_id,
    subfolder="scheduler"
)
pipeline, params = FlaxStableDiffusionPipeline.from_pretrained(
    model_id,
    scheduler=scheduler,
    revision="bf16",
    dtype=jax.numpy.bfloat16,
)
params["scheduler"] = scheduler_state

# Generate 1 image per parallel device (8 on TPUv2-8 or TPUv3-8)
prompt = "a photo of an astronaut riding a horse on mars"
num_samples = jax.device_count()
prompt_ids = pipeline.prepare_inputs([prompt] * num_samples)

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

# shard inputs and rng
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-keyword">import</span> jax
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> flax.jax_utils <span class="hljs-keyword">import</span> replicate
<span class="hljs-keyword">from</span> flax.training.common_utils <span class="hljs-keyword">import</span> shard

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> FlaxStableDiffusionPipeline, FlaxDPMSolverMultistepScheduler

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
scheduler, scheduler_state = FlaxDPMSolverMultistepScheduler.from_pretrained(
    model_id,
    subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>
)
pipeline, params = FlaxStableDiffusionPipeline.from_pretrained(
    model_id,
    scheduler=scheduler,
    revision=<span class="hljs-string">&quot;bf16&quot;</span>,
    dtype=jax.numpy.bfloat16,
)
params[<span class="hljs-string">&quot;scheduler&quot;</span>] = scheduler_state

<span class="hljs-comment"># Generate 1 image per parallel device (8 on TPUv2-8 or TPUv3-8)</span>
prompt = <span class="hljs-string">&quot;a photo of an astronaut riding a horse on mars&quot;</span>
num_samples = jax.device_count()
prompt_ids = pipeline.prepare_inputs([prompt] * num_samples)

prng_seed = jax.random.PRNGKey(<span class="hljs-number">0</span>)
num_inference_steps = <span class="hljs-number">25</span>

<span class="hljs-comment"># shard inputs and rng</span>
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=<span class="hljs-literal">True</span>).images
images = pipeline.numpy_to_pil(np.asarray(images.reshape((num_samples,) + images.shape[-<span class="hljs-number">3</span>:])))`}}),me=new gn({props:{warning:!0,$$slots:{default:[vn]},$$scope:{ctx:mt}}}),{c(){w=r("meta"),Z=u(),S=r("h1"),j=r("a"),U=r("span"),c(P.$$.fragment),x=u(),q=r("span"),W=o("Schedulers"),ee=u(),M=r("p"),J=o(`Diffusion pipelines are inherently a collection of diffusion models and schedulers that are partly independent from each other. This means that one is able to switch out parts of the pipeline to better customize
a pipeline to one\u2019s use case. The best example of this is the `),k=r("a"),_e=o("Schedulers"),y=o("."),E=u(),A=r("p"),se=o(`Whereas diffusion models usually simply define the forward pass from noise to a less noisy sample,
schedulers define the whole denoising process, `),te=r("em"),Je=o("i.e."),ze=o(":"),ge=u(),G=r("ul"),Js=r("li"),qr=o("How many denoising steps?"),Ar=u(),zs=r("li"),Nr=o("Stochastic or deterministic?"),Ir=u(),Xs=r("li"),Fr=o("What algorithm to use to find the denoised sample"),_t=u(),R=r("p"),Lr=o("They can be quite complex and often define a trade-off between "),Ks=r("strong"),Tr=o("denoising speed"),Cr=o(" and "),Ys=r("strong"),Gr=o("denoising quality"),Rr=o(`.
It is extremely difficult to measure quantitatively which scheduler works best for a given diffusion pipeline, so it is often recommended to simply try out which works best.`),gt=u(),Xe=r("p"),Or=o("The following paragraphs show how to do so with the \u{1F9E8} Diffusers library."),vt=u(),z=r("h2"),re=r("a"),Qs=r("span"),c(ve.$$.fragment),Br=u(),Vs=r("span"),Hr=o("Load pipeline"),wt=u(),le=r("p"),Ur=o(`Let\u2019s start by loading the stable diffusion pipeline.
Remember that you have to be a registered user on the \u{1F917} Hugging Face Hub, and have \u201Cclick-accepted\u201D the `),we=r("a"),Wr=o("license"),Jr=o(" in order to use stable diffusion."),$t=u(),c($e.$$.fragment),bt=u(),Ke=r("p"),zr=o("Next, we move it to GPU:"),St=u(),c(be.$$.fragment),yt=u(),X=r("h2"),ae=r("a"),Zs=r("span"),c(Se.$$.fragment),Xr=u(),et=r("span"),Kr=o("Access the scheduler"),Dt=u(),O=r("p"),Yr=o("The scheduler is always one of the components of the pipeline and is usually called "),st=r("code"),Qr=o('"scheduler"'),Vr=o(`.
So it can be accessed via the `),tt=r("code"),Zr=o('"scheduler"'),el=o(" property."),Et=u(),c(ye.$$.fragment),jt=u(),De=r("p"),rt=r("strong"),sl=o("Output"),tl=o(":"),Pt=u(),c(Ee.$$.fragment),xt=u(),ie=r("p"),rl=o("We can see that the scheduler is of type "),Ye=r("a"),ll=o("PNDMScheduler"),al=o(`.
Cool, now let\u2019s compare the scheduler in its performance to other schedulers.
First we define a prompt on which we will test all the different schedulers:`),Mt=u(),c(je.$$.fragment),kt=u(),Qe=r("p"),il=o("Next, we create a generator from a random seed that will ensure that we can generate similar images as well as run the pipeline:"),qt=u(),c(Pe.$$.fragment),At=u(),N=r("p"),nl=r("br"),ol=u(),Ve=r("img"),pl=u(),ul=r("br"),Nt=u(),K=r("h2"),ne=r("a"),lt=r("span"),c(xe.$$.fragment),fl=u(),at=r("span"),hl=o("Changing the scheduler"),It=u(),oe=r("p"),cl=o("Now we show how easy it is to change the scheduler of a pipeline. Every scheduler has a property "),it=r("code"),dl=o("SchedulerMixin.compatibles"),ml=o(`
which defines all compatible schedulers. You can take a look at all available, compatible schedulers for the Stable Diffusion pipeline as follows.`),Ft=u(),c(Me.$$.fragment),Lt=u(),ke=r("p"),nt=r("strong"),_l=o("Output"),gl=o(":"),Tt=u(),c(qe.$$.fragment),Ct=u(),Ze=r("p"),vl=o("Cool, lots of schedulers to look at. Feel free to have a look at their respective class definitions:"),Gt=u(),$=r("ul"),es=r("li"),ss=r("a"),wl=o("LMSDiscreteScheduler"),$l=o(","),bl=u(),ts=r("li"),rs=r("a"),Sl=o("DDIMScheduler"),yl=o(","),Dl=u(),ls=r("li"),as=r("a"),El=o("DPMSolverMultistepScheduler"),jl=o(","),Pl=u(),is=r("li"),ns=r("a"),xl=o("EulerDiscreteScheduler"),Ml=o(","),kl=u(),os=r("li"),ps=r("a"),ql=o("PNDMScheduler"),Al=o(","),Nl=u(),us=r("li"),fs=r("a"),Il=o("DDPMScheduler"),Fl=o(","),Ll=u(),hs=r("li"),cs=r("a"),Tl=o("EulerAncestralDiscreteScheduler"),Cl=o("."),Rt=u(),B=r("p"),Gl=o(`We will now compare the input prompt with all other schedulers. To change the scheduler of the pipeline you can make use of the
convenient `),ot=r("code"),Rl=o("ConfigMixin.config"),Ol=o(" property in combination with the "),ds=r("a"),Bl=o("ConfigMixin.from_config()"),Hl=o(" function."),Ot=u(),c(Ae.$$.fragment),Bt=u(),ms=r("p"),Ul=o("returns a dictionary of the configuration of the scheduler:"),Ht=u(),Ne=r("p"),pt=r("strong"),Wl=o("Output"),Jl=o(":"),Ut=u(),c(Ie.$$.fragment),Wt=u(),pe=r("p"),zl=o(`This configuration can then be used to instantiate a scheduler
of a different class that is compatible with the pipeline. Here,
we change the scheduler to the `),_s=r("a"),Xl=o("DDIMScheduler"),Kl=o("."),Jt=u(),c(Fe.$$.fragment),zt=u(),gs=r("p"),Yl=o("Cool, now we can run the pipeline again to compare the generation quality."),Xt=u(),c(Le.$$.fragment),Kt=u(),I=r("p"),Ql=r("br"),Vl=u(),vs=r("img"),Zl=u(),ea=r("br"),Yt=u(),ue=r("p"),sa=o("If you are a JAX/Flax user, please check "),ws=r("a"),ta=o("this section"),ra=o(" instead."),Qt=u(),Y=r("h2"),fe=r("a"),ut=r("span"),c(Te.$$.fragment),la=u(),ft=r("span"),aa=o("Compare schedulers"),Vt=u(),H=r("p"),ia=o("So far we have tried running the stable diffusion pipeline with two schedulers: "),$s=r("a"),na=o("PNDMScheduler"),oa=o(" and "),bs=r("a"),pa=o("DDIMScheduler"),ua=o(`.
A number of better schedulers have been released that can be run with much fewer steps, let\u2019s compare them here:`),Zt=u(),Ce=r("p"),Ss=r("a"),fa=o("LMSDiscreteScheduler"),ha=o(" usually leads to better results:"),er=u(),c(Ge.$$.fragment),sr=u(),F=r("p"),ca=r("br"),da=u(),ys=r("img"),ma=u(),_a=r("br"),tr=u(),Q=r("p"),Ds=r("a"),ga=o("EulerDiscreteScheduler"),va=o(" and "),Es=r("a"),wa=o("EulerAncestralDiscreteScheduler"),$a=o(" can generate high quality results with as little as 30 steps."),rr=u(),c(Re.$$.fragment),lr=u(),L=r("p"),ba=r("br"),Sa=u(),js=r("img"),ya=u(),Da=r("br"),ar=u(),Ps=r("p"),Ea=o("and:"),ir=u(),c(Oe.$$.fragment),nr=u(),T=r("p"),ja=r("br"),Pa=u(),xs=r("img"),xa=u(),Ma=r("br"),or=u(),he=r("p"),ka=o("At the time of writing this doc "),Ms=r("a"),qa=o("DPMSolverMultistepScheduler"),Aa=o(` gives arguably the best speed/quality trade-off and can be run with as little
as 20 steps.`),pr=u(),c(Be.$$.fragment),ur=u(),C=r("p"),Na=r("br"),Ia=u(),ks=r("img"),Fa=u(),La=r("br"),fr=u(),qs=r("p"),Ta=o(`As you can see most images look very similar and are arguably of very similar quality. It often really depends on the specific use case which scheduler to choose. A good approach is always to run multiple different
schedulers to compare results.`),hr=u(),V=r("h2"),ce=r("a"),ht=r("span"),c(He.$$.fragment),Ca=u(),ct=r("span"),Ga=o("Changing the Scheduler in Flax"),cr=u(),de=r("p"),Ra=o("If you are a JAX/Flax user, you can also change the default pipeline scheduler. This is a complete example of how to run inference using the Flax Stable Diffusion pipeline and the super-fast "),As=r("a"),Oa=o("DDPM-Solver++ scheduler"),Ba=o(":"),dr=u(),c(Ue.$$.fragment),mr=u(),c(me.$$.fragment),this.h()},l(e){const a=mn('[data-svelte="svelte-1phssyn"]',document.head);w=l(a,"META",{name:!0,content:!0}),a.forEach(s),Z=f(e),S=l(e,"H1",{class:!0});var We=i(S);j=l(We,"A",{id:!0,class:!0,href:!0});var ii=i(j);U=l(ii,"SPAN",{});var ni=i(U);d(P.$$.fragment,ni),ni.forEach(s),ii.forEach(s),x=f(We),q=l(We,"SPAN",{});var oi=i(q);W=p(oi,"Schedulers"),oi.forEach(s),We.forEach(s),ee=f(e),M=l(e,"P",{});var gr=i(M);J=p(gr,`Diffusion pipelines are inherently a collection of diffusion models and schedulers that are partly independent from each other. This means that one is able to switch out parts of the pipeline to better customize
a pipeline to one\u2019s use case. The best example of this is the `),k=l(gr,"A",{href:!0});var pi=i(k);_e=p(pi,"Schedulers"),pi.forEach(s),y=p(gr,"."),gr.forEach(s),E=f(e),A=l(e,"P",{});var vr=i(A);se=p(vr,`Whereas diffusion models usually simply define the forward pass from noise to a less noisy sample,
schedulers define the whole denoising process, `),te=l(vr,"EM",{});var ui=i(te);Je=p(ui,"i.e."),ui.forEach(s),ze=p(vr,":"),vr.forEach(s),ge=f(e),G=l(e,"UL",{});var Ns=i(G);Js=l(Ns,"LI",{});var fi=i(Js);qr=p(fi,"How many denoising steps?"),fi.forEach(s),Ar=f(Ns),zs=l(Ns,"LI",{});var hi=i(zs);Nr=p(hi,"Stochastic or deterministic?"),hi.forEach(s),Ir=f(Ns),Xs=l(Ns,"LI",{});var ci=i(Xs);Fr=p(ci,"What algorithm to use to find the denoised sample"),ci.forEach(s),Ns.forEach(s),_t=f(e),R=l(e,"P",{});var Is=i(R);Lr=p(Is,"They can be quite complex and often define a trade-off between "),Ks=l(Is,"STRONG",{});var di=i(Ks);Tr=p(di,"denoising speed"),di.forEach(s),Cr=p(Is," and "),Ys=l(Is,"STRONG",{});var mi=i(Ys);Gr=p(mi,"denoising quality"),mi.forEach(s),Rr=p(Is,`.
It is extremely difficult to measure quantitatively which scheduler works best for a given diffusion pipeline, so it is often recommended to simply try out which works best.`),Is.forEach(s),gt=f(e),Xe=l(e,"P",{});var _i=i(Xe);Or=p(_i,"The following paragraphs show how to do so with the \u{1F9E8} Diffusers library."),_i.forEach(s),vt=f(e),z=l(e,"H2",{class:!0});var wr=i(z);re=l(wr,"A",{id:!0,class:!0,href:!0});var gi=i(re);Qs=l(gi,"SPAN",{});var vi=i(Qs);d(ve.$$.fragment,vi),vi.forEach(s),gi.forEach(s),Br=f(wr),Vs=l(wr,"SPAN",{});var wi=i(Vs);Hr=p(wi,"Load pipeline"),wi.forEach(s),wr.forEach(s),wt=f(e),le=l(e,"P",{});var $r=i(le);Ur=p($r,`Let\u2019s start by loading the stable diffusion pipeline.
Remember that you have to be a registered user on the \u{1F917} Hugging Face Hub, and have \u201Cclick-accepted\u201D the `),we=l($r,"A",{href:!0,rel:!0});var $i=i(we);Wr=p($i,"license"),$i.forEach(s),Jr=p($r," in order to use stable diffusion."),$r.forEach(s),$t=f(e),d($e.$$.fragment,e),bt=f(e),Ke=l(e,"P",{});var bi=i(Ke);zr=p(bi,"Next, we move it to GPU:"),bi.forEach(s),St=f(e),d(be.$$.fragment,e),yt=f(e),X=l(e,"H2",{class:!0});var br=i(X);ae=l(br,"A",{id:!0,class:!0,href:!0});var Si=i(ae);Zs=l(Si,"SPAN",{});var yi=i(Zs);d(Se.$$.fragment,yi),yi.forEach(s),Si.forEach(s),Xr=f(br),et=l(br,"SPAN",{});var Di=i(et);Kr=p(Di,"Access the scheduler"),Di.forEach(s),br.forEach(s),Dt=f(e),O=l(e,"P",{});var Fs=i(O);Yr=p(Fs,"The scheduler is always one of the components of the pipeline and is usually called "),st=l(Fs,"CODE",{});var Ei=i(st);Qr=p(Ei,'"scheduler"'),Ei.forEach(s),Vr=p(Fs,`.
So it can be accessed via the `),tt=l(Fs,"CODE",{});var ji=i(tt);Zr=p(ji,'"scheduler"'),ji.forEach(s),el=p(Fs," property."),Fs.forEach(s),Et=f(e),d(ye.$$.fragment,e),jt=f(e),De=l(e,"P",{});var Ha=i(De);rt=l(Ha,"STRONG",{});var Pi=i(rt);sl=p(Pi,"Output"),Pi.forEach(s),tl=p(Ha,":"),Ha.forEach(s),Pt=f(e),d(Ee.$$.fragment,e),xt=f(e),ie=l(e,"P",{});var Sr=i(ie);rl=p(Sr,"We can see that the scheduler is of type "),Ye=l(Sr,"A",{href:!0});var xi=i(Ye);ll=p(xi,"PNDMScheduler"),xi.forEach(s),al=p(Sr,`.
Cool, now let\u2019s compare the scheduler in its performance to other schedulers.
First we define a prompt on which we will test all the different schedulers:`),Sr.forEach(s),Mt=f(e),d(je.$$.fragment,e),kt=f(e),Qe=l(e,"P",{});var Mi=i(Qe);il=p(Mi,"Next, we create a generator from a random seed that will ensure that we can generate similar images as well as run the pipeline:"),Mi.forEach(s),qt=f(e),d(Pe.$$.fragment,e),At=f(e),N=l(e,"P",{align:!0});var Ls=i(N);nl=l(Ls,"BR",{}),ol=f(Ls),Ve=l(Ls,"IMG",{src:!0,width:!0}),pl=f(Ls),ul=l(Ls,"BR",{}),Ls.forEach(s),Nt=f(e),K=l(e,"H2",{class:!0});var yr=i(K);ne=l(yr,"A",{id:!0,class:!0,href:!0});var ki=i(ne);lt=l(ki,"SPAN",{});var qi=i(lt);d(xe.$$.fragment,qi),qi.forEach(s),ki.forEach(s),fl=f(yr),at=l(yr,"SPAN",{});var Ai=i(at);hl=p(Ai,"Changing the scheduler"),Ai.forEach(s),yr.forEach(s),It=f(e),oe=l(e,"P",{});var Dr=i(oe);cl=p(Dr,"Now we show how easy it is to change the scheduler of a pipeline. Every scheduler has a property "),it=l(Dr,"CODE",{});var Ni=i(it);dl=p(Ni,"SchedulerMixin.compatibles"),Ni.forEach(s),ml=p(Dr,`
which defines all compatible schedulers. You can take a look at all available, compatible schedulers for the Stable Diffusion pipeline as follows.`),Dr.forEach(s),Ft=f(e),d(Me.$$.fragment,e),Lt=f(e),ke=l(e,"P",{});var Ua=i(ke);nt=l(Ua,"STRONG",{});var Ii=i(nt);_l=p(Ii,"Output"),Ii.forEach(s),gl=p(Ua,":"),Ua.forEach(s),Tt=f(e),d(qe.$$.fragment,e),Ct=f(e),Ze=l(e,"P",{});var Fi=i(Ze);vl=p(Fi,"Cool, lots of schedulers to look at. Feel free to have a look at their respective class definitions:"),Fi.forEach(s),Gt=f(e),$=l(e,"UL",{});var D=i($);es=l(D,"LI",{});var Wa=i(es);ss=l(Wa,"A",{href:!0});var Li=i(ss);wl=p(Li,"LMSDiscreteScheduler"),Li.forEach(s),$l=p(Wa,","),Wa.forEach(s),bl=f(D),ts=l(D,"LI",{});var Ja=i(ts);rs=l(Ja,"A",{href:!0});var Ti=i(rs);Sl=p(Ti,"DDIMScheduler"),Ti.forEach(s),yl=p(Ja,","),Ja.forEach(s),Dl=f(D),ls=l(D,"LI",{});var za=i(ls);as=l(za,"A",{href:!0});var Ci=i(as);El=p(Ci,"DPMSolverMultistepScheduler"),Ci.forEach(s),jl=p(za,","),za.forEach(s),Pl=f(D),is=l(D,"LI",{});var Xa=i(is);ns=l(Xa,"A",{href:!0});var Gi=i(ns);xl=p(Gi,"EulerDiscreteScheduler"),Gi.forEach(s),Ml=p(Xa,","),Xa.forEach(s),kl=f(D),os=l(D,"LI",{});var Ka=i(os);ps=l(Ka,"A",{href:!0});var Ri=i(ps);ql=p(Ri,"PNDMScheduler"),Ri.forEach(s),Al=p(Ka,","),Ka.forEach(s),Nl=f(D),us=l(D,"LI",{});var Ya=i(us);fs=l(Ya,"A",{href:!0});var Oi=i(fs);Il=p(Oi,"DDPMScheduler"),Oi.forEach(s),Fl=p(Ya,","),Ya.forEach(s),Ll=f(D),hs=l(D,"LI",{});var Qa=i(hs);cs=l(Qa,"A",{href:!0});var Bi=i(cs);Tl=p(Bi,"EulerAncestralDiscreteScheduler"),Bi.forEach(s),Cl=p(Qa,"."),Qa.forEach(s),D.forEach(s),Rt=f(e),B=l(e,"P",{});var Ts=i(B);Gl=p(Ts,`We will now compare the input prompt with all other schedulers. To change the scheduler of the pipeline you can make use of the
convenient `),ot=l(Ts,"CODE",{});var Hi=i(ot);Rl=p(Hi,"ConfigMixin.config"),Hi.forEach(s),Ol=p(Ts," property in combination with the "),ds=l(Ts,"A",{href:!0});var Ui=i(ds);Bl=p(Ui,"ConfigMixin.from_config()"),Ui.forEach(s),Hl=p(Ts," function."),Ts.forEach(s),Ot=f(e),d(Ae.$$.fragment,e),Bt=f(e),ms=l(e,"P",{});var Wi=i(ms);Ul=p(Wi,"returns a dictionary of the configuration of the scheduler:"),Wi.forEach(s),Ht=f(e),Ne=l(e,"P",{});var Va=i(Ne);pt=l(Va,"STRONG",{});var Ji=i(pt);Wl=p(Ji,"Output"),Ji.forEach(s),Jl=p(Va,":"),Va.forEach(s),Ut=f(e),d(Ie.$$.fragment,e),Wt=f(e),pe=l(e,"P",{});var Er=i(pe);zl=p(Er,`This configuration can then be used to instantiate a scheduler
of a different class that is compatible with the pipeline. Here,
we change the scheduler to the `),_s=l(Er,"A",{href:!0});var zi=i(_s);Xl=p(zi,"DDIMScheduler"),zi.forEach(s),Kl=p(Er,"."),Er.forEach(s),Jt=f(e),d(Fe.$$.fragment,e),zt=f(e),gs=l(e,"P",{});var Xi=i(gs);Yl=p(Xi,"Cool, now we can run the pipeline again to compare the generation quality."),Xi.forEach(s),Xt=f(e),d(Le.$$.fragment,e),Kt=f(e),I=l(e,"P",{align:!0});var Cs=i(I);Ql=l(Cs,"BR",{}),Vl=f(Cs),vs=l(Cs,"IMG",{src:!0,width:!0}),Zl=f(Cs),ea=l(Cs,"BR",{}),Cs.forEach(s),Yt=f(e),ue=l(e,"P",{});var jr=i(ue);sa=p(jr,"If you are a JAX/Flax user, please check "),ws=l(jr,"A",{href:!0});var Ki=i(ws);ta=p(Ki,"this section"),Ki.forEach(s),ra=p(jr," instead."),jr.forEach(s),Qt=f(e),Y=l(e,"H2",{class:!0});var Pr=i(Y);fe=l(Pr,"A",{id:!0,class:!0,href:!0});var Yi=i(fe);ut=l(Yi,"SPAN",{});var Qi=i(ut);d(Te.$$.fragment,Qi),Qi.forEach(s),Yi.forEach(s),la=f(Pr),ft=l(Pr,"SPAN",{});var Vi=i(ft);aa=p(Vi,"Compare schedulers"),Vi.forEach(s),Pr.forEach(s),Vt=f(e),H=l(e,"P",{});var Gs=i(H);ia=p(Gs,"So far we have tried running the stable diffusion pipeline with two schedulers: "),$s=l(Gs,"A",{href:!0});var Zi=i($s);na=p(Zi,"PNDMScheduler"),Zi.forEach(s),oa=p(Gs," and "),bs=l(Gs,"A",{href:!0});var en=i(bs);pa=p(en,"DDIMScheduler"),en.forEach(s),ua=p(Gs,`.
A number of better schedulers have been released that can be run with much fewer steps, let\u2019s compare them here:`),Gs.forEach(s),Zt=f(e),Ce=l(e,"P",{});var Za=i(Ce);Ss=l(Za,"A",{href:!0});var sn=i(Ss);fa=p(sn,"LMSDiscreteScheduler"),sn.forEach(s),ha=p(Za," usually leads to better results:"),Za.forEach(s),er=f(e),d(Ge.$$.fragment,e),sr=f(e),F=l(e,"P",{align:!0});var Rs=i(F);ca=l(Rs,"BR",{}),da=f(Rs),ys=l(Rs,"IMG",{src:!0,width:!0}),ma=f(Rs),_a=l(Rs,"BR",{}),Rs.forEach(s),tr=f(e),Q=l(e,"P",{});var dt=i(Q);Ds=l(dt,"A",{href:!0});var tn=i(Ds);ga=p(tn,"EulerDiscreteScheduler"),tn.forEach(s),va=p(dt," and "),Es=l(dt,"A",{href:!0});var rn=i(Es);wa=p(rn,"EulerAncestralDiscreteScheduler"),rn.forEach(s),$a=p(dt," can generate high quality results with as little as 30 steps."),dt.forEach(s),rr=f(e),d(Re.$$.fragment,e),lr=f(e),L=l(e,"P",{align:!0});var Os=i(L);ba=l(Os,"BR",{}),Sa=f(Os),js=l(Os,"IMG",{src:!0,width:!0}),ya=f(Os),Da=l(Os,"BR",{}),Os.forEach(s),ar=f(e),Ps=l(e,"P",{});var ln=i(Ps);Ea=p(ln,"and:"),ln.forEach(s),ir=f(e),d(Oe.$$.fragment,e),nr=f(e),T=l(e,"P",{align:!0});var Bs=i(T);ja=l(Bs,"BR",{}),Pa=f(Bs),xs=l(Bs,"IMG",{src:!0,width:!0}),xa=f(Bs),Ma=l(Bs,"BR",{}),Bs.forEach(s),or=f(e),he=l(e,"P",{});var xr=i(he);ka=p(xr,"At the time of writing this doc "),Ms=l(xr,"A",{href:!0});var an=i(Ms);qa=p(an,"DPMSolverMultistepScheduler"),an.forEach(s),Aa=p(xr,` gives arguably the best speed/quality trade-off and can be run with as little
as 20 steps.`),xr.forEach(s),pr=f(e),d(Be.$$.fragment,e),ur=f(e),C=l(e,"P",{align:!0});var Hs=i(C);Na=l(Hs,"BR",{}),Ia=f(Hs),ks=l(Hs,"IMG",{src:!0,width:!0}),Fa=f(Hs),La=l(Hs,"BR",{}),Hs.forEach(s),fr=f(e),qs=l(e,"P",{});var nn=i(qs);Ta=p(nn,`As you can see most images look very similar and are arguably of very similar quality. It often really depends on the specific use case which scheduler to choose. A good approach is always to run multiple different
schedulers to compare results.`),nn.forEach(s),hr=f(e),V=l(e,"H2",{class:!0});var Mr=i(V);ce=l(Mr,"A",{id:!0,class:!0,href:!0});var on=i(ce);ht=l(on,"SPAN",{});var pn=i(ht);d(He.$$.fragment,pn),pn.forEach(s),on.forEach(s),Ca=f(Mr),ct=l(Mr,"SPAN",{});var un=i(ct);Ga=p(un,"Changing the Scheduler in Flax"),un.forEach(s),Mr.forEach(s),cr=f(e),de=l(e,"P",{});var kr=i(de);Ra=p(kr,"If you are a JAX/Flax user, you can also change the default pipeline scheduler. This is a complete example of how to run inference using the Flax Stable Diffusion pipeline and the super-fast "),As=l(kr,"A",{href:!0});var fn=i(As);Oa=p(fn,"DDPM-Solver++ scheduler"),fn.forEach(s),Ba=p(kr,":"),kr.forEach(s),dr=f(e),d(Ue.$$.fragment,e),mr=f(e),d(me.$$.fragment,e),this.h()},h(){h(w,"name","hf:doc:metadata"),h(w,"content",JSON.stringify($n)),h(j,"id","schedulers"),h(j,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(j,"href","#schedulers"),h(S,"class","relative group"),h(k,"href","../api/schedulers/overview.mdx"),h(re,"id","load-pipeline"),h(re,"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"),h(re,"href","#load-pipeline"),h(z,"class","relative group"),h(we,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),h(we,"rel","nofollow"),h(ae,"id","access-the-scheduler"),h(ae,"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"),h(ae,"href","#access-the-scheduler"),h(X,"class","relative group"),h(Ye,"href","/docs/diffusers/v0.16.0/en/api/schedulers/pndm#diffusers.PNDMScheduler"),Us(Ve.src,ei="https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/diffusers_docs/astronaut_pndm.png")||h(Ve,"src",ei),h(Ve,"width","400"),h(N,"align","center"),h(ne,"id","changing-the-scheduler"),h(ne,"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"),h(ne,"href","#changing-the-scheduler"),h(K,"class","relative group"),h(ss,"href","/docs/diffusers/v0.16.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler"),h(rs,"href","/docs/diffusers/v0.16.0/en/api/schedulers/ddim#diffusers.DDIMScheduler"),h(as,"href","/docs/diffusers/v0.16.0/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler"),h(ns,"href","/docs/diffusers/v0.16.0/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler"),h(ps,"href","/docs/diffusers/v0.16.0/en/api/schedulers/pndm#diffusers.PNDMScheduler"),h(fs,"href","/docs/diffusers/v0.16.0/en/api/schedulers/ddpm#diffusers.DDPMScheduler"),h(cs,"href","/docs/diffusers/v0.16.0/en/api/schedulers/euler_ancestral#diffusers.EulerAncestralDiscreteScheduler"),h(ds,"href","/docs/diffusers/v0.16.0/en/api/configuration#diffusers.ConfigMixin.from_config"),h(_s,"href","/docs/diffusers/v0.16.0/en/api/schedulers/ddim#diffusers.DDIMScheduler"),Us(vs.src,si="https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/diffusers_docs/astronaut_ddim.png")||h(vs,"src",si),h(vs,"width","400"),h(I,"align","center"),h(ws,"href","#changing-the-scheduler-in-flax"),h(fe,"id","compare-schedulers"),h(fe,"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"),h(fe,"href","#compare-schedulers"),h(Y,"class","relative group"),h($s,"href","/docs/diffusers/v0.16.0/en/api/schedulers/pndm#diffusers.PNDMScheduler"),h(bs,"href","/docs/diffusers/v0.16.0/en/api/schedulers/ddim#diffusers.DDIMScheduler"),h(Ss,"href","/docs/diffusers/v0.16.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler"),Us(ys.src,ti="https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/diffusers_docs/astronaut_lms.png")||h(ys,"src",ti),h(ys,"width","400"),h(F,"align","center"),h(Ds,"href","/docs/diffusers/v0.16.0/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler"),h(Es,"href","/docs/diffusers/v0.16.0/en/api/schedulers/euler_ancestral#diffusers.EulerAncestralDiscreteScheduler"),Us(js.src,ri="https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/diffusers_docs/astronaut_euler_discrete.png")||h(js,"src",ri),h(js,"width","400"),h(L,"align","center"),Us(xs.src,li="https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/diffusers_docs/astronaut_euler_ancestral.png")||h(xs,"src",li),h(xs,"width","400"),h(T,"align","center"),h(Ms,"href","/docs/diffusers/v0.16.0/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler"),Us(ks.src,ai="https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/diffusers_docs/astronaut_dpm.png")||h(ks,"src",ai),h(ks,"width","400"),h(C,"align","center"),h(ce,"id","changing-the-scheduler-in-flax"),h(ce,"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"),h(ce,"href","#changing-the-scheduler-in-flax"),h(V,"class","relative group"),h(As,"href","../api/schedulers/multistep_dpm_solver")},m(e,a){t(document.head,w),n(e,Z,a),n(e,S,a),t(S,j),t(j,U),m(P,U,null),t(S,x),t(S,q),t(q,W),n(e,ee,a),n(e,M,a),t(M,J),t(M,k),t(k,_e),t(M,y),n(e,E,a),n(e,A,a),t(A,se),t(A,te),t(te,Je),t(A,ze),n(e,ge,a),n(e,G,a),t(G,Js),t(Js,qr),t(G,Ar),t(G,zs),t(zs,Nr),t(G,Ir),t(G,Xs),t(Xs,Fr),n(e,_t,a),n(e,R,a),t(R,Lr),t(R,Ks),t(Ks,Tr),t(R,Cr),t(R,Ys),t(Ys,Gr),t(R,Rr),n(e,gt,a),n(e,Xe,a),t(Xe,Or),n(e,vt,a),n(e,z,a),t(z,re),t(re,Qs),m(ve,Qs,null),t(z,Br),t(z,Vs),t(Vs,Hr),n(e,wt,a),n(e,le,a),t(le,Ur),t(le,we),t(we,Wr),t(le,Jr),n(e,$t,a),m($e,e,a),n(e,bt,a),n(e,Ke,a),t(Ke,zr),n(e,St,a),m(be,e,a),n(e,yt,a),n(e,X,a),t(X,ae),t(ae,Zs),m(Se,Zs,null),t(X,Xr),t(X,et),t(et,Kr),n(e,Dt,a),n(e,O,a),t(O,Yr),t(O,st),t(st,Qr),t(O,Vr),t(O,tt),t(tt,Zr),t(O,el),n(e,Et,a),m(ye,e,a),n(e,jt,a),n(e,De,a),t(De,rt),t(rt,sl),t(De,tl),n(e,Pt,a),m(Ee,e,a),n(e,xt,a),n(e,ie,a),t(ie,rl),t(ie,Ye),t(Ye,ll),t(ie,al),n(e,Mt,a),m(je,e,a),n(e,kt,a),n(e,Qe,a),t(Qe,il),n(e,qt,a),m(Pe,e,a),n(e,At,a),n(e,N,a),t(N,nl),t(N,ol),t(N,Ve),t(N,pl),t(N,ul),n(e,Nt,a),n(e,K,a),t(K,ne),t(ne,lt),m(xe,lt,null),t(K,fl),t(K,at),t(at,hl),n(e,It,a),n(e,oe,a),t(oe,cl),t(oe,it),t(it,dl),t(oe,ml),n(e,Ft,a),m(Me,e,a),n(e,Lt,a),n(e,ke,a),t(ke,nt),t(nt,_l),t(ke,gl),n(e,Tt,a),m(qe,e,a),n(e,Ct,a),n(e,Ze,a),t(Ze,vl),n(e,Gt,a),n(e,$,a),t($,es),t(es,ss),t(ss,wl),t(es,$l),t($,bl),t($,ts),t(ts,rs),t(rs,Sl),t(ts,yl),t($,Dl),t($,ls),t(ls,as),t(as,El),t(ls,jl),t($,Pl),t($,is),t(is,ns),t(ns,xl),t(is,Ml),t($,kl),t($,os),t(os,ps),t(ps,ql),t(os,Al),t($,Nl),t($,us),t(us,fs),t(fs,Il),t(us,Fl),t($,Ll),t($,hs),t(hs,cs),t(cs,Tl),t(hs,Cl),n(e,Rt,a),n(e,B,a),t(B,Gl),t(B,ot),t(ot,Rl),t(B,Ol),t(B,ds),t(ds,Bl),t(B,Hl),n(e,Ot,a),m(Ae,e,a),n(e,Bt,a),n(e,ms,a),t(ms,Ul),n(e,Ht,a),n(e,Ne,a),t(Ne,pt),t(pt,Wl),t(Ne,Jl),n(e,Ut,a),m(Ie,e,a),n(e,Wt,a),n(e,pe,a),t(pe,zl),t(pe,_s),t(_s,Xl),t(pe,Kl),n(e,Jt,a),m(Fe,e,a),n(e,zt,a),n(e,gs,a),t(gs,Yl),n(e,Xt,a),m(Le,e,a),n(e,Kt,a),n(e,I,a),t(I,Ql),t(I,Vl),t(I,vs),t(I,Zl),t(I,ea),n(e,Yt,a),n(e,ue,a),t(ue,sa),t(ue,ws),t(ws,ta),t(ue,ra),n(e,Qt,a),n(e,Y,a),t(Y,fe),t(fe,ut),m(Te,ut,null),t(Y,la),t(Y,ft),t(ft,aa),n(e,Vt,a),n(e,H,a),t(H,ia),t(H,$s),t($s,na),t(H,oa),t(H,bs),t(bs,pa),t(H,ua),n(e,Zt,a),n(e,Ce,a),t(Ce,Ss),t(Ss,fa),t(Ce,ha),n(e,er,a),m(Ge,e,a),n(e,sr,a),n(e,F,a),t(F,ca),t(F,da),t(F,ys),t(F,ma),t(F,_a),n(e,tr,a),n(e,Q,a),t(Q,Ds),t(Ds,ga),t(Q,va),t(Q,Es),t(Es,wa),t(Q,$a),n(e,rr,a),m(Re,e,a),n(e,lr,a),n(e,L,a),t(L,ba),t(L,Sa),t(L,js),t(L,ya),t(L,Da),n(e,ar,a),n(e,Ps,a),t(Ps,Ea),n(e,ir,a),m(Oe,e,a),n(e,nr,a),n(e,T,a),t(T,ja),t(T,Pa),t(T,xs),t(T,xa),t(T,Ma),n(e,or,a),n(e,he,a),t(he,ka),t(he,Ms),t(Ms,qa),t(he,Aa),n(e,pr,a),m(Be,e,a),n(e,ur,a),n(e,C,a),t(C,Na),t(C,Ia),t(C,ks),t(C,Fa),t(C,La),n(e,fr,a),n(e,qs,a),t(qs,Ta),n(e,hr,a),n(e,V,a),t(V,ce),t(ce,ht),m(He,ht,null),t(V,Ca),t(V,ct),t(ct,Ga),n(e,cr,a),n(e,de,a),t(de,Ra),t(de,As),t(As,Oa),t(de,Ba),n(e,dr,a),m(Ue,e,a),n(e,mr,a),m(me,e,a),_r=!0},p(e,[a]){const We={};a&2&&(We.$$scope={dirty:a,ctx:e}),me.$set(We)},i(e){_r||(_(P.$$.fragment,e),_(ve.$$.fragment,e),_($e.$$.fragment,e),_(be.$$.fragment,e),_(Se.$$.fragment,e),_(ye.$$.fragment,e),_(Ee.$$.fragment,e),_(je.$$.fragment,e),_(Pe.$$.fragment,e),_(xe.$$.fragment,e),_(Me.$$.fragment,e),_(qe.$$.fragment,e),_(Ae.$$.fragment,e),_(Ie.$$.fragment,e),_(Fe.$$.fragment,e),_(Le.$$.fragment,e),_(Te.$$.fragment,e),_(Ge.$$.fragment,e),_(Re.$$.fragment,e),_(Oe.$$.fragment,e),_(Be.$$.fragment,e),_(He.$$.fragment,e),_(Ue.$$.fragment,e),_(me.$$.fragment,e),_r=!0)},o(e){g(P.$$.fragment,e),g(ve.$$.fragment,e),g($e.$$.fragment,e),g(be.$$.fragment,e),g(Se.$$.fragment,e),g(ye.$$.fragment,e),g(Ee.$$.fragment,e),g(je.$$.fragment,e),g(Pe.$$.fragment,e),g(xe.$$.fragment,e),g(Me.$$.fragment,e),g(qe.$$.fragment,e),g(Ae.$$.fragment,e),g(Ie.$$.fragment,e),g(Fe.$$.fragment,e),g(Le.$$.fragment,e),g(Te.$$.fragment,e),g(Ge.$$.fragment,e),g(Re.$$.fragment,e),g(Oe.$$.fragment,e),g(Be.$$.fragment,e),g(He.$$.fragment,e),g(Ue.$$.fragment,e),g(me.$$.fragment,e),_r=!1},d(e){s(w),e&&s(Z),e&&s(S),v(P),e&&s(ee),e&&s(M),e&&s(E),e&&s(A),e&&s(ge),e&&s(G),e&&s(_t),e&&s(R),e&&s(gt),e&&s(Xe),e&&s(vt),e&&s(z),v(ve),e&&s(wt),e&&s(le),e&&s($t),v($e,e),e&&s(bt),e&&s(Ke),e&&s(St),v(be,e),e&&s(yt),e&&s(X),v(Se),e&&s(Dt),e&&s(O),e&&s(Et),v(ye,e),e&&s(jt),e&&s(De),e&&s(Pt),v(Ee,e),e&&s(xt),e&&s(ie),e&&s(Mt),v(je,e),e&&s(kt),e&&s(Qe),e&&s(qt),v(Pe,e),e&&s(At),e&&s(N),e&&s(Nt),e&&s(K),v(xe),e&&s(It),e&&s(oe),e&&s(Ft),v(Me,e),e&&s(Lt),e&&s(ke),e&&s(Tt),v(qe,e),e&&s(Ct),e&&s(Ze),e&&s(Gt),e&&s($),e&&s(Rt),e&&s(B),e&&s(Ot),v(Ae,e),e&&s(Bt),e&&s(ms),e&&s(Ht),e&&s(Ne),e&&s(Ut),v(Ie,e),e&&s(Wt),e&&s(pe),e&&s(Jt),v(Fe,e),e&&s(zt),e&&s(gs),e&&s(Xt),v(Le,e),e&&s(Kt),e&&s(I),e&&s(Yt),e&&s(ue),e&&s(Qt),e&&s(Y),v(Te),e&&s(Vt),e&&s(H),e&&s(Zt),e&&s(Ce),e&&s(er),v(Ge,e),e&&s(sr),e&&s(F),e&&s(tr),e&&s(Q),e&&s(rr),v(Re,e),e&&s(lr),e&&s(L),e&&s(ar),e&&s(Ps),e&&s(ir),v(Oe,e),e&&s(nr),e&&s(T),e&&s(or),e&&s(he),e&&s(pr),v(Be,e),e&&s(ur),e&&s(C),e&&s(fr),e&&s(qs),e&&s(hr),e&&s(V),v(He),e&&s(cr),e&&s(de),e&&s(dr),v(Ue,e),e&&s(mr),v(me,e)}}}const $n={local:"schedulers",sections:[{local:"load-pipeline",title:"Load pipeline"},{local:"access-the-scheduler",title:"Access the scheduler"},{local:"changing-the-scheduler",title:"Changing the scheduler"},{local:"compare-schedulers",title:"Compare schedulers"},{local:"changing-the-scheduler-in-flax",title:"Changing the Scheduler in Flax"}],title:"Schedulers"};function bn(mt){return _n(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class jn extends hn{constructor(w){super();cn(this,w,bn,wn,dn,{})}}export{jn as default,$n as metadata};
