import{S as At,i as Tt,s as kt,e as s,k as p,w as J,t as i,M as Pt,c as n,d as r,m as h,a as o,x as R,h as a,b as d,G as e,g as v,y as U,L as Nt,q as B,o as W,B as Y,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,j,x,De,K,Ie,de,D,y,Q,E,be,X,Me,le,I,ye,A,Se,$e,T,we,ce,b,S,Z,k,xe,ee,Ee,fe,c,P,Ae,N,Te,L,ke,Pe,Ne,l,q,Ce,Oe,te,Fe,Le,re,qe,ze,se,Ve,Ge,z,He,Je,V,Re,Ue,G,Be,We,Ye,H,je,C,Ke,Qe,$,O,Xe,ne,Ze,et,w,F,tt,oe,rt,pe;return x=new ot({}),E=new ot({}),k=new ot({}),P=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_zero",val:": bool = True"},{name:"steps_offset",val:": int = 0"},{name:"prediction_type",val:": str = 'epsilon'"},{name:"clip_sample_range",val:": float = 1.0"},{name:"**kwargs",val:""}],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 for numerical stability.`,name:"clip_sample"},{anchor:"diffusers.DDIMInverseScheduler.clip_sample_range",description:`<strong>clip_sample_range</strong> (<code>float</code>, default <code>1.0</code>) &#x2014;
the maximum magnitude for sample clipping. Valid only when <code>clip_sample=True</code>.`,name:"clip_sample_range"},{anchor:"diffusers.DDIMInverseScheduler.set_alpha_to_zero",description:`<strong>set_alpha_to_zero</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>0</code>,
otherwise it uses the value of alpha at step <code>num_train_timesteps - 1</code>.`,name:"set_alpha_to_zero"},{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_zero=False</code>, to make the last step use step <code>num_train_timesteps - 1</code> for the previous alpha
product.`,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/v0.16.0/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/v0.16.0/src/diffusers/schedulers/scheduling_ddim_inverse.py#L172",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/v0.16.0/src/diffusers/schedulers/scheduling_ddim_inverse.py#L186"}}),{c(){_=s("meta"),ae=p(),g=s("h1"),M=s("a"),j=s("span"),J(x.$$.fragment),De=p(),K=s("span"),Ie=i("Inverse Denoising Diffusion Implicit Models (DDIMInverse)"),de=p(),D=s("h2"),y=s("a"),Q=s("span"),J(E.$$.fragment),be=p(),X=s("span"),Me=i("Overview"),le=p(),I=s("p"),ye=i("This scheduler is the inverted scheduler of "),A=s("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=s("a"),we=i("Null-text Inversion for Editing Real Images using Guided Diffusion Models"),ce=p(),b=s("h2"),S=s("a"),Z=s("span"),J(k.$$.fragment),xe=p(),ee=s("span"),Ee=i("DDIMInverseScheduler"),fe=p(),c=s("div"),J(P.$$.fragment),Ae=p(),N=s("p"),Te=i("DDIMInverseScheduler is the reverse scheduler of "),L=s("a"),ke=i("DDIMScheduler"),Pe=i("."),Ne=p(),l=s("p"),q=s("a"),Ce=i("~ConfigMixin"),Oe=i(" takes care of storing all config attributes that are passed in the scheduler\u2019s "),te=s("code"),Fe=i("__init__"),Le=i(`
function, such as `),re=s("code"),qe=i("num_train_timesteps"),ze=i(". They can be accessed via "),se=s("code"),Ve=i("scheduler.config.num_train_timesteps"),Ge=i(`.
`),z=s("a"),He=i("SchedulerMixin"),Je=i(" provides general loading and saving functionality via the "),V=s("a"),Re=i("SchedulerMixin.save_pretrained()"),Ue=i(` and
`),G=s("a"),Be=i("from_pretrained()"),We=i(" functions."),Ye=p(),H=s("p"),je=i("For more details, see the original paper: "),C=s("a"),Ke=i("https://arxiv.org/abs/2010.02502"),Qe=p(),$=s("div"),J(O.$$.fragment),Xe=p(),ne=s("p"),Ze=i(`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),et=p(),w=s("div"),J(F.$$.fragment),tt=p(),oe=s("p"),rt=i("Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference."),this.h()},l(t){const u=Pt('[data-svelte="svelte-1phssyn"]',document.head);_=n(u,"META",{name:!0,content:!0}),u.forEach(r),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);j=n(at,"SPAN",{});var dt=o(j);R(x.$$.fragment,dt),dt.forEach(r),at.forEach(r),De=h(he),K=n(he,"SPAN",{});var lt=o(K);Ie=a(lt,"Inverse Denoising Diffusion Implicit Models (DDIMInverse)"),lt.forEach(r),he.forEach(r),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);R(E.$$.fragment,ft),ft.forEach(r),ct.forEach(r),be=h(ue),X=n(ue,"SPAN",{});var pt=o(X);Me=a(pt,"Overview"),pt.forEach(r),ue.forEach(r),le=h(t),I=n(t,"P",{});var ie=o(I);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(r),$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(r),ie.forEach(r),ce=h(t),b=n(t,"H2",{class:!0});var me=o(b);S=n(me,"A",{id:!0,class:!0,href:!0});var mt=o(S);Z=n(mt,"SPAN",{});var vt=o(Z);R(k.$$.fragment,vt),vt.forEach(r),mt.forEach(r),xe=h(me),ee=n(me,"SPAN",{});var _t=o(ee);Ee=a(_t,"DDIMInverseScheduler"),_t.forEach(r),me.forEach(r),fe=h(t),c=n(t,"DIV",{class:!0});var m=o(c);R(P.$$.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);ke=a(gt,"DDIMScheduler"),gt.forEach(r),Pe=a(ve,"."),ve.forEach(r),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(r),Oe=a(f," takes care of storing all config attributes that are passed in the scheduler\u2019s "),te=n(f,"CODE",{});var It=o(te);Fe=a(It,"__init__"),It.forEach(r),Le=a(f,`
function, such as `),re=n(f,"CODE",{});var bt=o(re);qe=a(bt,"num_train_timesteps"),bt.forEach(r),ze=a(f,". They can be accessed via "),se=n(f,"CODE",{});var Mt=o(se);Ve=a(Mt,"scheduler.config.num_train_timesteps"),Mt.forEach(r),Ge=a(f,`.
`),z=n(f,"A",{href:!0});var yt=o(z);He=a(yt,"SchedulerMixin"),yt.forEach(r),Je=a(f," provides general loading and saving functionality via the "),V=n(f,"A",{href:!0});var St=o(V);Re=a(St,"SchedulerMixin.save_pretrained()"),St.forEach(r),Ue=a(f,` and
`),G=n(f,"A",{href:!0});var $t=o(G);Be=a($t,"from_pretrained()"),$t.forEach(r),We=a(f," functions."),f.forEach(r),Ye=h(m),H=n(m,"P",{});var st=o(H);je=a(st,"For more details, see the original paper: "),C=n(st,"A",{href:!0,rel:!0});var wt=o(C);Ke=a(wt,"https://arxiv.org/abs/2010.02502"),wt.forEach(r),st.forEach(r),Qe=h(m),$=n(m,"DIV",{class:!0});var _e=o($);R(O.$$.fragment,_e),Xe=h(_e),ne=n(_e,"P",{});var xt=o(ne);Ze=a(xt,`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),xt.forEach(r),_e.forEach(r),et=h(m),w=n(m,"DIV",{class:!0});var ge=o(w);R(F.$$.fragment,ge),tt=h(ge),oe=n(ge,"P",{});var Et=o(oe);rt=a(Et,"Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference."),Et.forEach(r),ge.forEach(r),m.forEach(r),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(b,"class","relative group"),d(L,"href","/docs/diffusers/v0.16.0/en/api/schedulers/ddim#diffusers.DDIMScheduler"),d(q,"href","/docs/diffusers/v0.16.0/en/api/configuration#diffusers.ConfigMixin"),d(z,"href","/docs/diffusers/v0.16.0/en/api/schedulers/overview#diffusers.SchedulerMixin"),d(V,"href","/docs/diffusers/v0.16.0/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained"),d(G,"href","/docs/diffusers/v0.16.0/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,j),U(x,j,null),e(g,De),e(g,K),e(K,Ie),v(t,de,u),v(t,D,u),e(D,y),e(y,Q),U(E,Q,null),e(D,be),e(D,X),e(X,Me),v(t,le,u),v(t,I,u),e(I,ye),e(I,A),e(A,Se),e(I,$e),e(I,T),e(T,we),v(t,ce,u),v(t,b,u),e(b,S),e(S,Z),U(k,Z,null),e(b,xe),e(b,ee),e(ee,Ee),v(t,fe,u),v(t,c,u),U(P,c,null),e(c,Ae),e(c,N),e(N,Te),e(N,L),e(L,ke),e(N,Pe),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,re),e(re,qe),e(l,ze),e(l,se),e(se,Ve),e(l,Ge),e(l,z),e(z,He),e(l,Je),e(l,V),e(V,Re),e(l,Ue),e(l,G),e(G,Be),e(l,We),e(c,Ye),e(c,H),e(H,je),e(H,C),e(C,Ke),e(c,Qe),e(c,$),U(O,$,null),e($,Xe),e($,ne),e(ne,Ze),e(c,et),e(c,w),U(F,w,null),e(w,tt),e(w,oe),e(oe,rt),pe=!0},p:Nt,i(t){pe||(B(x.$$.fragment,t),B(E.$$.fragment,t),B(k.$$.fragment,t),B(P.$$.fragment,t),B(O.$$.fragment,t),B(F.$$.fragment,t),pe=!0)},o(t){W(x.$$.fragment,t),W(E.$$.fragment,t),W(k.$$.fragment,t),W(P.$$.fragment,t),W(O.$$.fragment,t),W(F.$$.fragment,t),pe=!1},d(t){r(_),t&&r(ae),t&&r(g),Y(x),t&&r(de),t&&r(D),Y(E),t&&r(le),t&&r(I),t&&r(ce),t&&r(b),Y(k),t&&r(fe),t&&r(c),Y(P),Y(O),Y(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 Gt extends At{constructor(_){super();Tt(this,_,Lt,Ot,kt,{})}}export{Gt as default,Ft as metadata};
