import{S as Ut,i as Ht,s as Ot,e as s,k as d,w as ot,t as i,M as Bt,c as r,d as l,m as f,a as o,x as it,h as a,b as n,G as e,g as u,y as at,L as Gt,q as nt,o as ht,B as dt,v as Jt}from"../chunks/vendor-hf-doc-builder.js";import{I as ft}from"../chunks/IconCopyLink-hf-doc-builder.js";function Rt(ut){let b,se,w,E,F,M,_e,K,be,re,R,we,oe,v,Q,ge,ye,V,Ee,Se,W,Ae,ie,g,S,X,I,xe,Y,$e,ae,A,k,Pe,Z,De,Me,Ie,T,ke,ee,Te,Le,ne,y,x,te,L,Ne,le,qe,he,_,c,Ce,N,Ue,He,q,Oe,Be,C,Ge,Je,Re,p,je,U,ze,Fe,H,Ke,Qe,O,Ve,We,Xe,m,Ye,B,Ze,et,G,tt,lt,J,st,rt,de;return M=new ft({}),I=new ft({}),L=new ft({}),{c(){b=s("meta"),se=d(),w=s("h1"),E=s("a"),F=s("span"),ot(M.$$.fragment),_e=d(),K=s("span"),be=i("Schedulers"),re=d(),R=s("p"),we=i(`The base class [\u2018SchedulerMixin\u2019] implements low level utilities used by multiple schedulers.
At a high level:`),oe=d(),v=s("ul"),Q=s("li"),ge=i("Schedulers are the algorithms to use diffusion models in inference as well as for training. They include the noise schedules and define algorithm-specific diffusion steps."),ye=d(),V=s("li"),Ee=i("Schedulers can be used interchangable between diffusion models in inference to find the preferred tradef-off between speed and generation quality."),Se=d(),W=s("li"),Ae=i("Schedulers are available in numpy, but can easily be transformed into PyTorch."),ie=d(),g=s("h2"),S=s("a"),X=s("span"),ot(I.$$.fragment),xe=d(),Y=s("span"),$e=i("API"),ae=d(),A=s("ul"),k=s("li"),Pe=i("Schedulers should provide one or more "),Z=s("code"),De=i("def step(...)"),Me=i(` functions that should be called iteratively to unroll the diffusion loop during
the forward pass.`),Ie=d(),T=s("li"),ke=i(`Schedulers should be framework-agonstic, but provide a simple functionality to convert the scheduler into a specific framework, such as PyTorch
with a `),ee=s("code"),Te=i("set_format(...)"),Le=i(" method."),ne=d(),y=s("h2"),x=s("a"),te=s("span"),ot(L.$$.fragment),Ne=d(),le=s("span"),qe=i("Examples"),he=d(),_=s("ul"),c=s("li"),Ce=i("The [\u2018DDPMScheduler\u2019] was proposed in "),N=s("a"),Ue=i("Denoising Diffusion Probabilistic Models"),He=i(" and can be found in "),q=s("a"),Oe=i("scheduling_ddpm.py"),Be=i(`.
An example of how to use this scheduler can be found in `),C=s("a"),Ge=i("pipeline_ddpm.py"),Je=i("."),Re=d(),p=s("li"),je=i("The [\u2018DDIMScheduler\u2019] was proposed in "),U=s("a"),ze=i("Denoising Diffusion Implicit Models"),Fe=i(" and can be found in "),H=s("a"),Ke=i("scheduling_ddim.py"),Qe=i(". An example of how to use this scheduler can be found in "),O=s("a"),Ve=i("pipeline_ddim.py"),We=i("."),Xe=d(),m=s("li"),Ye=i("The [\u2018PNDMScheduler\u2019] was proposed in "),B=s("a"),Ze=i("Pseudo Numerical Methods for Diffusion Models on Manifolds"),et=i(" and can be found in "),G=s("a"),tt=i("scheduling_pndm.py"),lt=i(". An example of how to use this scheduler can be found in "),J=s("a"),st=i("pipeline_pndm.py"),rt=i("."),this.h()},l(t){const h=Bt('[data-svelte="svelte-1phssyn"]',document.head);b=r(h,"META",{name:!0,content:!0}),h.forEach(l),se=f(t),w=r(t,"H1",{class:!0});var fe=o(w);E=r(fe,"A",{id:!0,class:!0,href:!0});var ct=o(E);F=r(ct,"SPAN",{});var pt=o(F);it(M.$$.fragment,pt),pt.forEach(l),ct.forEach(l),_e=f(fe),K=r(fe,"SPAN",{});var mt=o(K);be=a(mt,"Schedulers"),mt.forEach(l),fe.forEach(l),re=f(t),R=r(t,"P",{});var vt=o(R);we=a(vt,`The base class [\u2018SchedulerMixin\u2019] implements low level utilities used by multiple schedulers.
At a high level:`),vt.forEach(l),oe=f(t),v=r(t,"UL",{});var j=o(v);Q=r(j,"LI",{});var _t=o(Q);ge=a(_t,"Schedulers are the algorithms to use diffusion models in inference as well as for training. They include the noise schedules and define algorithm-specific diffusion steps."),_t.forEach(l),ye=f(j),V=r(j,"LI",{});var bt=o(V);Ee=a(bt,"Schedulers can be used interchangable between diffusion models in inference to find the preferred tradef-off between speed and generation quality."),bt.forEach(l),Se=f(j),W=r(j,"LI",{});var wt=o(W);Ae=a(wt,"Schedulers are available in numpy, but can easily be transformed into PyTorch."),wt.forEach(l),j.forEach(l),ie=f(t),g=r(t,"H2",{class:!0});var ue=o(g);S=r(ue,"A",{id:!0,class:!0,href:!0});var gt=o(S);X=r(gt,"SPAN",{});var yt=o(X);it(I.$$.fragment,yt),yt.forEach(l),gt.forEach(l),xe=f(ue),Y=r(ue,"SPAN",{});var Et=o(Y);$e=a(Et,"API"),Et.forEach(l),ue.forEach(l),ae=f(t),A=r(t,"UL",{});var ce=o(A);k=r(ce,"LI",{});var pe=o(k);Pe=a(pe,"Schedulers should provide one or more "),Z=r(pe,"CODE",{});var St=o(Z);De=a(St,"def step(...)"),St.forEach(l),Me=a(pe,` functions that should be called iteratively to unroll the diffusion loop during
the forward pass.`),pe.forEach(l),Ie=f(ce),T=r(ce,"LI",{});var me=o(T);ke=a(me,`Schedulers should be framework-agonstic, but provide a simple functionality to convert the scheduler into a specific framework, such as PyTorch
with a `),ee=r(me,"CODE",{});var At=o(ee);Te=a(At,"set_format(...)"),At.forEach(l),Le=a(me," method."),me.forEach(l),ce.forEach(l),ne=f(t),y=r(t,"H2",{class:!0});var ve=o(y);x=r(ve,"A",{id:!0,class:!0,href:!0});var xt=o(x);te=r(xt,"SPAN",{});var $t=o(te);it(L.$$.fragment,$t),$t.forEach(l),xt.forEach(l),Ne=f(ve),le=r(ve,"SPAN",{});var Pt=o(le);qe=a(Pt,"Examples"),Pt.forEach(l),ve.forEach(l),he=f(t),_=r(t,"UL",{});var z=o(_);c=r(z,"LI",{});var $=o(c);Ce=a($,"The [\u2018DDPMScheduler\u2019] was proposed in "),N=r($,"A",{href:!0,rel:!0});var Dt=o(N);Ue=a(Dt,"Denoising Diffusion Probabilistic Models"),Dt.forEach(l),He=a($," and can be found in "),q=r($,"A",{href:!0,rel:!0});var Mt=o(q);Oe=a(Mt,"scheduling_ddpm.py"),Mt.forEach(l),Be=a($,`.
An example of how to use this scheduler can be found in `),C=r($,"A",{href:!0,rel:!0});var It=o(C);Ge=a(It,"pipeline_ddpm.py"),It.forEach(l),Je=a($,"."),$.forEach(l),Re=f(z),p=r(z,"LI",{});var P=o(p);je=a(P,"The [\u2018DDIMScheduler\u2019] was proposed in "),U=r(P,"A",{href:!0,rel:!0});var kt=o(U);ze=a(kt,"Denoising Diffusion Implicit Models"),kt.forEach(l),Fe=a(P," and can be found in "),H=r(P,"A",{href:!0,rel:!0});var Tt=o(H);Ke=a(Tt,"scheduling_ddim.py"),Tt.forEach(l),Qe=a(P,". An example of how to use this scheduler can be found in "),O=r(P,"A",{href:!0,rel:!0});var Lt=o(O);Ve=a(Lt,"pipeline_ddim.py"),Lt.forEach(l),We=a(P,"."),P.forEach(l),Xe=f(z),m=r(z,"LI",{});var D=o(m);Ye=a(D,"The [\u2018PNDMScheduler\u2019] was proposed in "),B=r(D,"A",{href:!0,rel:!0});var Nt=o(B);Ze=a(Nt,"Pseudo Numerical Methods for Diffusion Models on Manifolds"),Nt.forEach(l),et=a(D," and can be found in "),G=r(D,"A",{href:!0,rel:!0});var qt=o(G);tt=a(qt,"scheduling_pndm.py"),qt.forEach(l),lt=a(D,". An example of how to use this scheduler can be found in "),J=r(D,"A",{href:!0,rel:!0});var Ct=o(J);st=a(Ct,"pipeline_pndm.py"),Ct.forEach(l),rt=a(D,"."),D.forEach(l),z.forEach(l),this.h()},h(){n(b,"name","hf:doc:metadata"),n(b,"content",JSON.stringify(jt)),n(E,"id","schedulers"),n(E,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),n(E,"href","#schedulers"),n(w,"class","relative group"),n(S,"id","api"),n(S,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),n(S,"href","#api"),n(g,"class","relative group"),n(x,"id","examples"),n(x,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),n(x,"href","#examples"),n(y,"class","relative group"),n(N,"href","https://arxiv.org/abs/2006.11239"),n(N,"rel","nofollow"),n(q,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddpm.py"),n(q,"rel","nofollow"),n(C,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_ddpm.py"),n(C,"rel","nofollow"),n(U,"href","https://arxiv.org/abs/2010.02502"),n(U,"rel","nofollow"),n(H,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim.py"),n(H,"rel","nofollow"),n(O,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_ddim.py"),n(O,"rel","nofollow"),n(B,"href","https://arxiv.org/abs/2202.09778"),n(B,"rel","nofollow"),n(G,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_pndm.py"),n(G,"rel","nofollow"),n(J,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_pndm.py"),n(J,"rel","nofollow")},m(t,h){e(document.head,b),u(t,se,h),u(t,w,h),e(w,E),e(E,F),at(M,F,null),e(w,_e),e(w,K),e(K,be),u(t,re,h),u(t,R,h),e(R,we),u(t,oe,h),u(t,v,h),e(v,Q),e(Q,ge),e(v,ye),e(v,V),e(V,Ee),e(v,Se),e(v,W),e(W,Ae),u(t,ie,h),u(t,g,h),e(g,S),e(S,X),at(I,X,null),e(g,xe),e(g,Y),e(Y,$e),u(t,ae,h),u(t,A,h),e(A,k),e(k,Pe),e(k,Z),e(Z,De),e(k,Me),e(A,Ie),e(A,T),e(T,ke),e(T,ee),e(ee,Te),e(T,Le),u(t,ne,h),u(t,y,h),e(y,x),e(x,te),at(L,te,null),e(y,Ne),e(y,le),e(le,qe),u(t,he,h),u(t,_,h),e(_,c),e(c,Ce),e(c,N),e(N,Ue),e(c,He),e(c,q),e(q,Oe),e(c,Be),e(c,C),e(C,Ge),e(c,Je),e(_,Re),e(_,p),e(p,je),e(p,U),e(U,ze),e(p,Fe),e(p,H),e(H,Ke),e(p,Qe),e(p,O),e(O,Ve),e(p,We),e(_,Xe),e(_,m),e(m,Ye),e(m,B),e(B,Ze),e(m,et),e(m,G),e(G,tt),e(m,lt),e(m,J),e(J,st),e(m,rt),de=!0},p:Gt,i(t){de||(nt(M.$$.fragment,t),nt(I.$$.fragment,t),nt(L.$$.fragment,t),de=!0)},o(t){ht(M.$$.fragment,t),ht(I.$$.fragment,t),ht(L.$$.fragment,t),de=!1},d(t){l(b),t&&l(se),t&&l(w),dt(M),t&&l(re),t&&l(R),t&&l(oe),t&&l(v),t&&l(ie),t&&l(g),dt(I),t&&l(ae),t&&l(A),t&&l(ne),t&&l(y),dt(L),t&&l(he),t&&l(_)}}}const jt={local:"schedulers",sections:[{local:"api",title:"API"},{local:"examples",title:"Examples"}],title:"Schedulers"};function zt(ut){return Jt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qt extends Ut{constructor(b){super();Ht(this,b,zt,Rt,Ot,{})}}export{Qt as default,jt as metadata};
