import{S as Tt,i as Ot,s as Lt,e as s,k as u,w as V,t as a,M as Ft,c as n,d as r,m as p,a as o,x as q,h as l,b as i,G as e,g as v,y as H,L as Ct,q as U,o as z,B,v as Vt}from"../../../chunks/vendor-hf-doc-builder.js";import{D as we}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as dt}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function qt(ct){let g,le,_,w,Q,x,ye,X,Se,de,b,y,Y,N,Pe,Z,Ee,ce,S,De,I,Me,xe,ue,$,P,ee,k,Ne,te,Ie,pe,d,A,ke,G,Ae,T,Te,Oe,c,J,Le,Fe,re,Ce,Ve,se,qe,He,ne,Ue,ze,R,Be,Ge,W,Je,Re,j,We,je,Ke,K,Qe,O,Xe,Ye,E,L,Ze,oe,et,tt,D,F,rt,ie,st,nt,M,C,ot,ae,it,fe;return x=new dt({}),N=new dt({}),k=new dt({}),A=new we({props:{name:"class diffusers.IPNDMScheduler",anchor:"diffusers.IPNDMScheduler",parameters:[{name:"num_train_timesteps",val:": int = 1000"},{name:"trained_betas",val:": typing.Union[numpy.ndarray, typing.List[float], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.IPNDMScheduler.num_train_timesteps",description:"<strong>num_train_timesteps</strong> (<code>int</code>) &#x2014; number of diffusion steps used to train the model.",name:"num_train_timesteps"}],source:"https://github.com/huggingface/diffusers/blob/v0.19.0/src/diffusers/schedulers/scheduling_ipndm.py#L25"}}),L=new we({props:{name:"scale_model_input",anchor:"diffusers.IPNDMScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.IPNDMScheduler.scale_model_input.sample",description:"<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014; input sample",name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.19.0/src/diffusers/schedulers/scheduling_ipndm.py#L135",returnDescription:`
<p>scaled input sample</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),F=new we({props:{name:"set_timesteps",anchor:"diffusers.IPNDMScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.IPNDMScheduler.set_timesteps.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>) &#x2014;
the number of diffusion steps used when generating samples with a pre-trained model.`,name:"num_inference_steps"}],source:"https://github.com/huggingface/diffusers/blob/v0.19.0/src/diffusers/schedulers/scheduling_ipndm.py#L61"}}),C=new we({props:{name:"step",anchor:"diffusers.IPNDMScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.IPNDMScheduler.step.model_output",description:"<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014; direct output from learned diffusion model.",name:"model_output"},{anchor:"diffusers.IPNDMScheduler.step.timestep",description:"<strong>timestep</strong> (<code>int</code>) &#x2014; current discrete timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.IPNDMScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
current instance of sample being created by diffusion process.`,name:"sample"},{anchor:"diffusers.IPNDMScheduler.step.return_dict",description:"<strong>return_dict</strong> (<code>bool</code>) &#x2014; option for returning tuple rather than SchedulerOutput class",name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.19.0/src/diffusers/schedulers/scheduling_ipndm.py#L85",returnDescription:`
<p><code>~scheduling_utils.SchedulerOutput</code> if <code>return_dict</code> is
True, otherwise a <code>tuple</code>. When returning a tuple, the first element is the sample tensor.</p>
`,returnType:`
<p><code>~scheduling_utils.SchedulerOutput</code> or <code>tuple</code></p>
`}}),{c(){g=s("meta"),le=u(),_=s("h1"),w=s("a"),Q=s("span"),V(x.$$.fragment),ye=u(),X=s("span"),Se=a("improved pseudo numerical methods for diffusion models (iPNDM)"),de=u(),b=s("h2"),y=s("a"),Y=s("span"),V(N.$$.fragment),Pe=u(),Z=s("span"),Ee=a("Overview"),ce=u(),S=s("p"),De=a("Original implementation can be found "),I=s("a"),Me=a("here"),xe=a("."),ue=u(),$=s("h2"),P=s("a"),ee=s("span"),V(k.$$.fragment),Ne=u(),te=s("span"),Ie=a("IPNDMScheduler"),pe=u(),d=s("div"),V(A.$$.fragment),ke=u(),G=s("p"),Ae=a(`Improved Pseudo numerical methods for diffusion models (iPNDM) ported from @crowsonkb\u2019s amazing k-diffusion
`),T=s("a"),Te=a("library"),Oe=u(),c=s("p"),J=s("a"),Le=a("~ConfigMixin"),Fe=a(" takes care of storing all config attributes that are passed in the scheduler\u2019s "),re=s("code"),Ce=a("__init__"),Ve=a(`
function, such as `),se=s("code"),qe=a("num_train_timesteps"),He=a(". They can be accessed via "),ne=s("code"),Ue=a("scheduler.config.num_train_timesteps"),ze=a(`.
`),R=s("a"),Be=a("SchedulerMixin"),Ge=a(" provides general loading and saving functionality via the "),W=s("a"),Je=a("SchedulerMixin.save_pretrained()"),Re=a(` and
`),j=s("a"),We=a("from_pretrained()"),je=a(" functions."),Ke=u(),K=s("p"),Qe=a("For more details, see the original paper: "),O=s("a"),Xe=a("https://arxiv.org/abs/2202.09778"),Ye=u(),E=s("div"),V(L.$$.fragment),Ze=u(),oe=s("p"),et=a(`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),tt=u(),D=s("div"),V(F.$$.fragment),rt=u(),ie=s("p"),st=a("Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference."),nt=u(),M=s("div"),V(C.$$.fragment),ot=u(),ae=s("p"),it=a(`Step function propagating the sample with the linear multi-step method. This has one forward pass with multiple
times to approximate the solution.`),this.h()},l(t){const m=Ft('[data-svelte="svelte-1phssyn"]',document.head);g=n(m,"META",{name:!0,content:!0}),m.forEach(r),le=p(t),_=n(t,"H1",{class:!0});var he=o(_);w=n(he,"A",{id:!0,class:!0,href:!0});var ut=o(w);Q=n(ut,"SPAN",{});var pt=o(Q);q(x.$$.fragment,pt),pt.forEach(r),ut.forEach(r),ye=p(he),X=n(he,"SPAN",{});var ft=o(X);Se=l(ft,"improved pseudo numerical methods for diffusion models (iPNDM)"),ft.forEach(r),he.forEach(r),de=p(t),b=n(t,"H2",{class:!0});var me=o(b);y=n(me,"A",{id:!0,class:!0,href:!0});var ht=o(y);Y=n(ht,"SPAN",{});var mt=o(Y);q(N.$$.fragment,mt),mt.forEach(r),ht.forEach(r),Pe=p(me),Z=n(me,"SPAN",{});var vt=o(Z);Ee=l(vt,"Overview"),vt.forEach(r),me.forEach(r),ce=p(t),S=n(t,"P",{});var ve=o(S);De=l(ve,"Original implementation can be found "),I=n(ve,"A",{href:!0,rel:!0});var gt=o(I);Me=l(gt,"here"),gt.forEach(r),xe=l(ve,"."),ve.forEach(r),ue=p(t),$=n(t,"H2",{class:!0});var ge=o($);P=n(ge,"A",{id:!0,class:!0,href:!0});var _t=o(P);ee=n(_t,"SPAN",{});var bt=o(ee);q(k.$$.fragment,bt),bt.forEach(r),_t.forEach(r),Ne=p(ge),te=n(ge,"SPAN",{});var $t=o(te);Ie=l($t,"IPNDMScheduler"),$t.forEach(r),ge.forEach(r),pe=p(t),d=n(t,"DIV",{class:!0});var h=o(d);q(A.$$.fragment,h),ke=p(h),G=n(h,"P",{});var at=o(G);Ae=l(at,`Improved Pseudo numerical methods for diffusion models (iPNDM) ported from @crowsonkb\u2019s amazing k-diffusion
`),T=n(at,"A",{href:!0,rel:!0});var wt=o(T);Te=l(wt,"library"),wt.forEach(r),at.forEach(r),Oe=p(h),c=n(h,"P",{});var f=o(c);J=n(f,"A",{href:!0});var yt=o(J);Le=l(yt,"~ConfigMixin"),yt.forEach(r),Fe=l(f," takes care of storing all config attributes that are passed in the scheduler\u2019s "),re=n(f,"CODE",{});var St=o(re);Ce=l(St,"__init__"),St.forEach(r),Ve=l(f,`
function, such as `),se=n(f,"CODE",{});var Pt=o(se);qe=l(Pt,"num_train_timesteps"),Pt.forEach(r),He=l(f,". They can be accessed via "),ne=n(f,"CODE",{});var Et=o(ne);Ue=l(Et,"scheduler.config.num_train_timesteps"),Et.forEach(r),ze=l(f,`.
`),R=n(f,"A",{href:!0});var Dt=o(R);Be=l(Dt,"SchedulerMixin"),Dt.forEach(r),Ge=l(f," provides general loading and saving functionality via the "),W=n(f,"A",{href:!0});var Mt=o(W);Je=l(Mt,"SchedulerMixin.save_pretrained()"),Mt.forEach(r),Re=l(f,` and
`),j=n(f,"A",{href:!0});var xt=o(j);We=l(xt,"from_pretrained()"),xt.forEach(r),je=l(f," functions."),f.forEach(r),Ke=p(h),K=n(h,"P",{});var lt=o(K);Qe=l(lt,"For more details, see the original paper: "),O=n(lt,"A",{href:!0,rel:!0});var Nt=o(O);Xe=l(Nt,"https://arxiv.org/abs/2202.09778"),Nt.forEach(r),lt.forEach(r),Ye=p(h),E=n(h,"DIV",{class:!0});var _e=o(E);q(L.$$.fragment,_e),Ze=p(_e),oe=n(_e,"P",{});var It=o(oe);et=l(It,`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),It.forEach(r),_e.forEach(r),tt=p(h),D=n(h,"DIV",{class:!0});var be=o(D);q(F.$$.fragment,be),rt=p(be),ie=n(be,"P",{});var kt=o(ie);st=l(kt,"Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference."),kt.forEach(r),be.forEach(r),nt=p(h),M=n(h,"DIV",{class:!0});var $e=o(M);q(C.$$.fragment,$e),ot=p($e),ae=n($e,"P",{});var At=o(ae);it=l(At,`Step function propagating the sample with the linear multi-step method. This has one forward pass with multiple
times to approximate the solution.`),At.forEach(r),$e.forEach(r),h.forEach(r),this.h()},h(){i(g,"name","hf:doc:metadata"),i(g,"content",JSON.stringify(Ht)),i(w,"id","improved-pseudo-numerical-methods-for-diffusion-models-ipndm"),i(w,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(w,"href","#improved-pseudo-numerical-methods-for-diffusion-models-ipndm"),i(_,"class","relative group"),i(y,"id","overview"),i(y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(y,"href","#overview"),i(b,"class","relative group"),i(I,"href","https://github.com/crowsonkb/v-diffusion-pytorch/blob/987f8985e38208345c1959b0ea767a625831cc9b/diffusion/sampling.py#L296"),i(I,"rel","nofollow"),i(P,"id","diffusers.IPNDMScheduler"),i(P,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(P,"href","#diffusers.IPNDMScheduler"),i($,"class","relative group"),i(T,"href","https://github.com/crowsonkb/v-diffusion-pytorch/blob/987f8985e38208345c1959b0ea767a625831cc9b/diffusion/sampling.py#L296"),i(T,"rel","nofollow"),i(J,"href","/docs/diffusers/v0.19.0/en/api/configuration#diffusers.ConfigMixin"),i(R,"href","/docs/diffusers/v0.19.0/en/api/schedulers/overview#diffusers.SchedulerMixin"),i(W,"href","/docs/diffusers/v0.19.0/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained"),i(j,"href","/docs/diffusers/v0.19.0/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),i(O,"href","https://arxiv.org/abs/2202.09778"),i(O,"rel","nofollow"),i(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,m){e(document.head,g),v(t,le,m),v(t,_,m),e(_,w),e(w,Q),H(x,Q,null),e(_,ye),e(_,X),e(X,Se),v(t,de,m),v(t,b,m),e(b,y),e(y,Y),H(N,Y,null),e(b,Pe),e(b,Z),e(Z,Ee),v(t,ce,m),v(t,S,m),e(S,De),e(S,I),e(I,Me),e(S,xe),v(t,ue,m),v(t,$,m),e($,P),e(P,ee),H(k,ee,null),e($,Ne),e($,te),e(te,Ie),v(t,pe,m),v(t,d,m),H(A,d,null),e(d,ke),e(d,G),e(G,Ae),e(G,T),e(T,Te),e(d,Oe),e(d,c),e(c,J),e(J,Le),e(c,Fe),e(c,re),e(re,Ce),e(c,Ve),e(c,se),e(se,qe),e(c,He),e(c,ne),e(ne,Ue),e(c,ze),e(c,R),e(R,Be),e(c,Ge),e(c,W),e(W,Je),e(c,Re),e(c,j),e(j,We),e(c,je),e(d,Ke),e(d,K),e(K,Qe),e(K,O),e(O,Xe),e(d,Ye),e(d,E),H(L,E,null),e(E,Ze),e(E,oe),e(oe,et),e(d,tt),e(d,D),H(F,D,null),e(D,rt),e(D,ie),e(ie,st),e(d,nt),e(d,M),H(C,M,null),e(M,ot),e(M,ae),e(ae,it),fe=!0},p:Ct,i(t){fe||(U(x.$$.fragment,t),U(N.$$.fragment,t),U(k.$$.fragment,t),U(A.$$.fragment,t),U(L.$$.fragment,t),U(F.$$.fragment,t),U(C.$$.fragment,t),fe=!0)},o(t){z(x.$$.fragment,t),z(N.$$.fragment,t),z(k.$$.fragment,t),z(A.$$.fragment,t),z(L.$$.fragment,t),z(F.$$.fragment,t),z(C.$$.fragment,t),fe=!1},d(t){r(g),t&&r(le),t&&r(_),B(x),t&&r(de),t&&r(b),B(N),t&&r(ce),t&&r(S),t&&r(ue),t&&r($),B(k),t&&r(pe),t&&r(d),B(A),B(L),B(F),B(C)}}}const Ht={local:"improved-pseudo-numerical-methods-for-diffusion-models-ipndm",sections:[{local:"overview",title:"Overview"},{local:"diffusers.IPNDMScheduler",title:"IPNDMScheduler"}],title:"improved pseudo numerical methods for diffusion models (iPNDM)"};function Ut(ct){return Vt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Jt extends Tt{constructor(g){super();Ot(this,g,Ut,qt,Lt,{})}}export{Jt as default,Ht as metadata};
