import{S as At,i as Tt,s as Pt,e as r,k as p,w as U,t as i,M as kt,c as n,d as s,m as h,a as o,x as V,h as a,b as d,G as e,g as v,y as B,L as Nt,q as W,o as Y,B as j,v as Ct}from"../../../chunks/vendor-hf-doc-builder.js";import{D as nt}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as ot}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function Ot(it){let _,ae,g,M,z,E,De,K,be,de,D,y,Q,x,Ie,X,Me,le,b,ye,A,Se,$e,T,we,ce,I,S,Z,P,Ee,ee,xe,fe,c,k,Ae,N,Te,L,Pe,ke,Ne,l,q,Ce,Oe,te,Fe,Le,se,qe,Ge,re,He,Je,G,Re,Ue,H,Ve,Be,J,We,Ye,je,R,ze,C,Ke,Qe,$,O,Xe,ne,Ze,et,w,F,tt,oe,st,pe;return E=new ot({}),x=new ot({}),P=new ot({}),k=new nt({props:{name:"class diffusers.DDIMInverseScheduler",anchor:"diffusers.DDIMInverseScheduler",parameters:[{name:"num_train_timesteps",val:": int = 1000"},{name:"beta_start",val:": float = 0.0001"},{name:"beta_end",val:": float = 0.02"},{name:"beta_schedule",val:": str = 'linear'"},{name:"trained_betas",val:": typing.Union[numpy.ndarray, typing.List[float], NoneType] = None"},{name:"clip_sample",val:": bool = True"},{name:"set_alpha_to_one",val:": bool = True"},{name:"steps_offset",val:": int = 0"},{name:"prediction_type",val:": str = 'epsilon'"}],parametersDescription:[{anchor:"diffusers.DDIMInverseScheduler.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"},{anchor:"diffusers.DDIMInverseScheduler.beta_start",description:"<strong>beta_start</strong> (<code>float</code>) &#x2014; the starting <code>beta</code> value of inference.",name:"beta_start"},{anchor:"diffusers.DDIMInverseScheduler.beta_end",description:"<strong>beta_end</strong> (<code>float</code>) &#x2014; the final <code>beta</code> value.",name:"beta_end"},{anchor:"diffusers.DDIMInverseScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>str</code>) &#x2014;
the beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
<code>linear</code>, <code>scaled_linear</code>, or <code>squaredcos_cap_v2</code>.`,name:"beta_schedule"},{anchor:"diffusers.DDIMInverseScheduler.trained_betas",description:`<strong>trained_betas</strong> (<code>np.ndarray</code>, optional) &#x2014;
option to pass an array of betas directly to the constructor to bypass <code>beta_start</code>, <code>beta_end</code> etc.`,name:"trained_betas"},{anchor:"diffusers.DDIMInverseScheduler.clip_sample",description:`<strong>clip_sample</strong> (<code>bool</code>, default <code>True</code>) &#x2014;
option to clip predicted sample between -1 and 1 for numerical stability.`,name:"clip_sample"},{anchor:"diffusers.DDIMInverseScheduler.set_alpha_to_one",description:`<strong>set_alpha_to_one</strong> (<code>bool</code>, default <code>True</code>) &#x2014;
each diffusion step uses the value of alphas product at that step and at the previous one. For the final
step there is no previous alpha. When this option is <code>True</code> the previous alpha product is fixed to <code>1</code>,
otherwise it uses the value of alpha at step 0.`,name:"set_alpha_to_one"},{anchor:"diffusers.DDIMInverseScheduler.steps_offset",description:`<strong>steps_offset</strong> (<code>int</code>, default <code>0</code>) &#x2014;
an offset added to the inference steps. You can use a combination of <code>offset=1</code> and
<code>set_alpha_to_one=False</code>, to make the last step use step 0 for the previous alpha product, as done in
stable diffusion.`,name:"steps_offset"},{anchor:"diffusers.DDIMInverseScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, default <code>epsilon</code>, optional) &#x2014;
prediction type of the scheduler function, one of <code>epsilon</code> (predicting the noise of the diffusion
process), <code>sample</code> (directly predicting the noisy sample<code>) or </code>v_prediction\` (see section 2.4
<a href="https://imagen.research.google/video/paper.pdf" rel="nofollow">https://imagen.research.google/video/paper.pdf</a>)`,name:"prediction_type"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim_inverse.py#L78"}}),O=new nt({props:{name:"scale_model_input",anchor:"diffusers.DDIMInverseScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.DDIMInverseScheduler.scale_model_input.sample",description:"<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014; input sample",name:"sample"},{anchor:"diffusers.DDIMInverseScheduler.scale_model_input.timestep",description:"<strong>timestep</strong> (<code>int</code>, optional) &#x2014; current timestep",name:"timestep"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim_inverse.py#L160",returnDescription:`
<p>scaled input sample</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),F=new nt({props:{name:"set_timesteps",anchor:"diffusers.DDIMInverseScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.DDIMInverseScheduler.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/main/src/diffusers/schedulers/scheduling_ddim_inverse.py#L174"}}),{c(){_=r("meta"),ae=p(),g=r("h1"),M=r("a"),z=r("span"),U(E.$$.fragment),De=p(),K=r("span"),be=i("Inverse Denoising Diffusion Implicit Models (DDIMInverse)"),de=p(),D=r("h2"),y=r("a"),Q=r("span"),U(x.$$.fragment),Ie=p(),X=r("span"),Me=i("Overview"),le=p(),b=r("p"),ye=i("This scheduler is the inverted scheduler of "),A=r("a"),Se=i("Denoising Diffusion Implicit Models"),$e=i(` (DDIM) by Jiaming Song, Chenlin Meng and Stefano Ermon.
The implementation is mostly based on the DDIM inversion definition of `),T=r("a"),we=i("Null-text Inversion for Editing Real Images using Guided Diffusion Models"),ce=p(),I=r("h2"),S=r("a"),Z=r("span"),U(P.$$.fragment),Ee=p(),ee=r("span"),xe=i("DDIMInverseScheduler"),fe=p(),c=r("div"),U(k.$$.fragment),Ae=p(),N=r("p"),Te=i("DDIMInverseScheduler is the reverse scheduler of "),L=r("a"),Pe=i("DDIMScheduler"),ke=i("."),Ne=p(),l=r("p"),q=r("a"),Ce=i("~ConfigMixin"),Oe=i(" takes care of storing all config attributes that are passed in the scheduler\u2019s "),te=r("code"),Fe=i("__init__"),Le=i(`
function, such as `),se=r("code"),qe=i("num_train_timesteps"),Ge=i(". They can be accessed via "),re=r("code"),He=i("scheduler.config.num_train_timesteps"),Je=i(`.
`),G=r("a"),Re=i("SchedulerMixin"),Ue=i(" provides general loading and saving functionality via the "),H=r("a"),Ve=i("SchedulerMixin.save_pretrained()"),Be=i(` and
`),J=r("a"),We=i("from_pretrained()"),Ye=i(" functions."),je=p(),R=r("p"),ze=i("For more details, see the original paper: "),C=r("a"),Ke=i("https://arxiv.org/abs/2010.02502"),Qe=p(),$=r("div"),U(O.$$.fragment),Xe=p(),ne=r("p"),Ze=i(`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),et=p(),w=r("div"),U(F.$$.fragment),tt=p(),oe=r("p"),st=i("Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference."),this.h()},l(t){const u=kt('[data-svelte="svelte-1phssyn"]',document.head);_=n(u,"META",{name:!0,content:!0}),u.forEach(s),ae=h(t),g=n(t,"H1",{class:!0});var he=o(g);M=n(he,"A",{id:!0,class:!0,href:!0});var at=o(M);z=n(at,"SPAN",{});var dt=o(z);V(E.$$.fragment,dt),dt.forEach(s),at.forEach(s),De=h(he),K=n(he,"SPAN",{});var lt=o(K);be=a(lt,"Inverse Denoising Diffusion Implicit Models (DDIMInverse)"),lt.forEach(s),he.forEach(s),de=h(t),D=n(t,"H2",{class:!0});var ue=o(D);y=n(ue,"A",{id:!0,class:!0,href:!0});var ct=o(y);Q=n(ct,"SPAN",{});var ft=o(Q);V(x.$$.fragment,ft),ft.forEach(s),ct.forEach(s),Ie=h(ue),X=n(ue,"SPAN",{});var pt=o(X);Me=a(pt,"Overview"),pt.forEach(s),ue.forEach(s),le=h(t),b=n(t,"P",{});var ie=o(b);ye=a(ie,"This scheduler is the inverted scheduler of "),A=n(ie,"A",{href:!0,rel:!0});var ht=o(A);Se=a(ht,"Denoising Diffusion Implicit Models"),ht.forEach(s),$e=a(ie,` (DDIM) by Jiaming Song, Chenlin Meng and Stefano Ermon.
The implementation is mostly based on the DDIM inversion definition of `),T=n(ie,"A",{href:!0,rel:!0});var ut=o(T);we=a(ut,"Null-text Inversion for Editing Real Images using Guided Diffusion Models"),ut.forEach(s),ie.forEach(s),ce=h(t),I=n(t,"H2",{class:!0});var me=o(I);S=n(me,"A",{id:!0,class:!0,href:!0});var mt=o(S);Z=n(mt,"SPAN",{});var vt=o(Z);V(P.$$.fragment,vt),vt.forEach(s),mt.forEach(s),Ee=h(me),ee=n(me,"SPAN",{});var _t=o(ee);xe=a(_t,"DDIMInverseScheduler"),_t.forEach(s),me.forEach(s),fe=h(t),c=n(t,"DIV",{class:!0});var m=o(c);V(k.$$.fragment,m),Ae=h(m),N=n(m,"P",{});var ve=o(N);Te=a(ve,"DDIMInverseScheduler is the reverse scheduler of "),L=n(ve,"A",{href:!0});var gt=o(L);Pe=a(gt,"DDIMScheduler"),gt.forEach(s),ke=a(ve,"."),ve.forEach(s),Ne=h(m),l=n(m,"P",{});var f=o(l);q=n(f,"A",{href:!0});var Dt=o(q);Ce=a(Dt,"~ConfigMixin"),Dt.forEach(s),Oe=a(f," takes care of storing all config attributes that are passed in the scheduler\u2019s "),te=n(f,"CODE",{});var bt=o(te);Fe=a(bt,"__init__"),bt.forEach(s),Le=a(f,`
function, such as `),se=n(f,"CODE",{});var It=o(se);qe=a(It,"num_train_timesteps"),It.forEach(s),Ge=a(f,". They can be accessed via "),re=n(f,"CODE",{});var Mt=o(re);He=a(Mt,"scheduler.config.num_train_timesteps"),Mt.forEach(s),Je=a(f,`.
`),G=n(f,"A",{href:!0});var yt=o(G);Re=a(yt,"SchedulerMixin"),yt.forEach(s),Ue=a(f," provides general loading and saving functionality via the "),H=n(f,"A",{href:!0});var St=o(H);Ve=a(St,"SchedulerMixin.save_pretrained()"),St.forEach(s),Be=a(f,` and
`),J=n(f,"A",{href:!0});var $t=o(J);We=a($t,"from_pretrained()"),$t.forEach(s),Ye=a(f," functions."),f.forEach(s),je=h(m),R=n(m,"P",{});var rt=o(R);ze=a(rt,"For more details, see the original paper: "),C=n(rt,"A",{href:!0,rel:!0});var wt=o(C);Ke=a(wt,"https://arxiv.org/abs/2010.02502"),wt.forEach(s),rt.forEach(s),Qe=h(m),$=n(m,"DIV",{class:!0});var _e=o($);V(O.$$.fragment,_e),Xe=h(_e),ne=n(_e,"P",{});var Et=o(ne);Ze=a(Et,`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),Et.forEach(s),_e.forEach(s),et=h(m),w=n(m,"DIV",{class:!0});var ge=o(w);V(F.$$.fragment,ge),tt=h(ge),oe=n(ge,"P",{});var xt=o(oe);st=a(xt,"Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference."),xt.forEach(s),ge.forEach(s),m.forEach(s),this.h()},h(){d(_,"name","hf:doc:metadata"),d(_,"content",JSON.stringify(Ft)),d(M,"id","inverse-denoising-diffusion-implicit-models-ddiminverse"),d(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"),d(M,"href","#inverse-denoising-diffusion-implicit-models-ddiminverse"),d(g,"class","relative group"),d(y,"id","overview"),d(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"),d(y,"href","#overview"),d(D,"class","relative group"),d(A,"href","https://arxiv.org/abs/2010.02502"),d(A,"rel","nofollow"),d(T,"href","https://arxiv.org/pdf/2211.09794.pdf"),d(T,"rel","nofollow"),d(S,"id","diffusers.DDIMInverseScheduler"),d(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"),d(S,"href","#diffusers.DDIMInverseScheduler"),d(I,"class","relative group"),d(L,"href","/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler"),d(q,"href","/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin"),d(G,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin"),d(H,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained"),d(J,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),d(C,"href","https://arxiv.org/abs/2010.02502"),d(C,"rel","nofollow"),d($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(c,"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,u){e(document.head,_),v(t,ae,u),v(t,g,u),e(g,M),e(M,z),B(E,z,null),e(g,De),e(g,K),e(K,be),v(t,de,u),v(t,D,u),e(D,y),e(y,Q),B(x,Q,null),e(D,Ie),e(D,X),e(X,Me),v(t,le,u),v(t,b,u),e(b,ye),e(b,A),e(A,Se),e(b,$e),e(b,T),e(T,we),v(t,ce,u),v(t,I,u),e(I,S),e(S,Z),B(P,Z,null),e(I,Ee),e(I,ee),e(ee,xe),v(t,fe,u),v(t,c,u),B(k,c,null),e(c,Ae),e(c,N),e(N,Te),e(N,L),e(L,Pe),e(N,ke),e(c,Ne),e(c,l),e(l,q),e(q,Ce),e(l,Oe),e(l,te),e(te,Fe),e(l,Le),e(l,se),e(se,qe),e(l,Ge),e(l,re),e(re,He),e(l,Je),e(l,G),e(G,Re),e(l,Ue),e(l,H),e(H,Ve),e(l,Be),e(l,J),e(J,We),e(l,Ye),e(c,je),e(c,R),e(R,ze),e(R,C),e(C,Ke),e(c,Qe),e(c,$),B(O,$,null),e($,Xe),e($,ne),e(ne,Ze),e(c,et),e(c,w),B(F,w,null),e(w,tt),e(w,oe),e(oe,st),pe=!0},p:Nt,i(t){pe||(W(E.$$.fragment,t),W(x.$$.fragment,t),W(P.$$.fragment,t),W(k.$$.fragment,t),W(O.$$.fragment,t),W(F.$$.fragment,t),pe=!0)},o(t){Y(E.$$.fragment,t),Y(x.$$.fragment,t),Y(P.$$.fragment,t),Y(k.$$.fragment,t),Y(O.$$.fragment,t),Y(F.$$.fragment,t),pe=!1},d(t){s(_),t&&s(ae),t&&s(g),j(E),t&&s(de),t&&s(D),j(x),t&&s(le),t&&s(b),t&&s(ce),t&&s(I),j(P),t&&s(fe),t&&s(c),j(k),j(O),j(F)}}}const Ft={local:"inverse-denoising-diffusion-implicit-models-ddiminverse",sections:[{local:"overview",title:"Overview"},{local:"diffusers.DDIMInverseScheduler",title:"DDIMInverseScheduler"}],title:"Inverse Denoising Diffusion Implicit Models (DDIMInverse)"};function Lt(it){return Ct(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Jt extends At{constructor(_){super();Tt(this,_,Lt,Ot,Pt,{})}}export{Jt as default,Ft as metadata};
