import{s as pe,n as ue,o as fe}from"../chunks/scheduler.182ea377.js";import{S as me,i as he,g as i,s as o,r as y,A as ge,h as d,f as t,c as a,j as w,u as C,x as P,k as E,y as n,a as l,v as F,d as L,t as q,w as H}from"../chunks/index.abf12888.js";import{D as B}from"../chunks/Docstring.93f6f462.js";import{H as le}from"../chunks/Heading.16916d63.js";function _e(ne){let p,A,z,V,h,k,g,re=`<code>DDIMInverseScheduler</code> is the inverted scheduler from <a href="https://huggingface.co/papers/2010.02502" rel="nofollow">Denoising Diffusion Implicit Models</a> (DDIM) by Jiaming Song, Chenlin Meng and Stefano Ermon.
The implementation is mostly based on the DDIM inversion definition from <a href="https://huggingface.co/papers/2211.09794" rel="nofollow">Null-text Inversion for Editing Real Images using Guided Diffusion Models</a>.`,O,_,R,s,v,K,x,oe='<code>DDIMInverseScheduler</code> is the reverse scheduler of <a href="/docs/diffusers/v0.27.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>.',Q,M,ae=`This model inherits from <a href="/docs/diffusers/v0.27.0/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/v0.27.0/en/api/configuration#diffusers.ConfigMixin">ConfigMixin</a>. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`,X,u,D,Y,S,ie=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,Z,f,b,ee,$,de="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",te,m,I,se,T,ce=`Predict the sample from the previous timestep by reversing the SDE. This function propagates the diffusion
process from the learned model outputs (most often the predicted noise).`,U,N,W;return h=new le({props:{title:"DDIMInverseScheduler",local:"ddiminversescheduler",headingTag:"h1"}}),_=new le({props:{title:"DDIMInverseScheduler",local:"diffusers.DDIMInverseScheduler",headingTag:"h2"}}),v=new B({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:": Union = 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'"},{name:"clip_sample_range",val:": float = 1.0"},{name:"timestep_spacing",val:": str = 'leading'"},{name:"rescale_betas_zero_snr",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DDIMInverseScheduler.num_train_timesteps",description:`<strong>num_train_timesteps</strong> (<code>int</code>, defaults to 1000) &#x2014;
The number of diffusion steps to train the model.`,name:"num_train_timesteps"},{anchor:"diffusers.DDIMInverseScheduler.beta_start",description:`<strong>beta_start</strong> (<code>float</code>, defaults to 0.0001) &#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>, defaults to 0.02) &#x2014;
The final <code>beta</code> value.`,name:"beta_end"},{anchor:"diffusers.DDIMInverseScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>str</code>, defaults to <code>&quot;linear&quot;</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>, <em>optional</em>) &#x2014;
Pass an array of betas directly to the constructor to bypass <code>beta_start</code> and <code>beta_end</code>.`,name:"trained_betas"},{anchor:"diffusers.DDIMInverseScheduler.clip_sample",description:`<strong>clip_sample</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Clip the predicted sample for numerical stability.`,name:"clip_sample"},{anchor:"diffusers.DDIMInverseScheduler.clip_sample_range",description:`<strong>clip_sample_range</strong> (<code>float</code>, defaults to 1.0) &#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_one",description:`<strong>set_alpha_to_one</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Each diffusion step uses the alphas product value 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 0, otherwise
it uses the alpha value at step <code>num_train_timesteps - 1</code>.`,name:"set_alpha_to_one"},{anchor:"diffusers.DDIMInverseScheduler.steps_offset",description:`<strong>steps_offset</strong> (<code>int</code>, defaults to 0) &#x2014;
An offset added to the inference steps, as required by some model families.`,name:"steps_offset"},{anchor:"diffusers.DDIMInverseScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, defaults to <code>epsilon</code>, <em>optional</em>) &#x2014;
Prediction type of the scheduler function; can be <code>epsilon</code> (predicts the noise of the diffusion process),
<code>sample</code> (directly predicts the noisy sample<code>) or </code>v_prediction\` (see section 2.4 of <a href="https://imagen.research.google/video/paper.pdf" rel="nofollow">Imagen
Video</a> paper).`,name:"prediction_type"},{anchor:"diffusers.DDIMInverseScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>str</code>, defaults to <code>&quot;leading&quot;</code>) &#x2014;
The way the timesteps should be scaled. Refer to Table 2 of the <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and
Sample Steps are Flawed</a> for more information.`,name:"timestep_spacing"},{anchor:"diffusers.DDIMInverseScheduler.rescale_betas_zero_snr",description:`<strong>rescale_betas_zero_snr</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to rescale the betas to have zero terminal SNR. This enables the model to generate very bright and
dark samples instead of limiting it to samples with medium brightness. Loosely related to
<a href="https://github.com/huggingface/diffusers/blob/74fd735eb073eb1d774b1ab4154a0876eb82f055/examples/dreambooth/train_dreambooth.py#L506" rel="nofollow"><code>--offset_noise</code></a>.`,name:"rescale_betas_zero_snr"}],source:"https://github.com/huggingface/diffusers/blob/v0.27.0/src/diffusers/schedulers/scheduling_ddim_inverse.py#L130"}}),D=new B({props:{name:"scale_model_input",anchor:"diffusers.DDIMInverseScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.DDIMInverseScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.DDIMInverseScheduler.scale_model_input.timestep",description:`<strong>timestep</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The current timestep in the diffusion chain.`,name:"timestep"}],source:"https://github.com/huggingface/diffusers/blob/v0.27.0/src/diffusers/schedulers/scheduling_ddim_inverse.py#L234",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A scaled input sample.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.FloatTensor</code></p>
`}}),b=new B({props:{name:"set_timesteps",anchor:"diffusers.DDIMInverseScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": Union = 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.27.0/src/diffusers/schedulers/scheduling_ddim_inverse.py#L251"}}),I=new B({props:{name:"step",anchor:"diffusers.DDIMInverseScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.DDIMInverseScheduler.step.model_output",description:`<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014;
The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.DDIMInverseScheduler.step.timestep",description:`<strong>timestep</strong> (<code>float</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.DDIMInverseScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
A current instance of a sample created by the diffusion process.`,name:"sample"},{anchor:"diffusers.DDIMInverseScheduler.step.eta",description:`<strong>eta</strong> (<code>float</code>) &#x2014;
The weight of noise for added noise in diffusion step.`,name:"eta"},{anchor:"diffusers.DDIMInverseScheduler.step.use_clipped_model_output",description:`<strong>use_clipped_model_output</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, computes &#x201C;corrected&#x201D; <code>model_output</code> from the clipped predicted original sample. Necessary
because predicted original sample is clipped to [-1, 1] when <code>self.config.clip_sample</code> is <code>True</code>. If no
clipping has happened, &#x201C;corrected&#x201D; <code>model_output</code> would coincide with the one provided as input and
<code>use_clipped_model_output</code> has no effect.`,name:"use_clipped_model_output"},{anchor:"diffusers.DDIMInverseScheduler.step.variance_noise",description:`<strong>variance_noise</strong> (<code>torch.FloatTensor</code>) &#x2014;
Alternative to generating noise with <code>generator</code> by directly providing the noise for the variance
itself. Useful for methods such as <code>CycleDiffusion</code>.`,name:"variance_noise"},{anchor:"diffusers.DDIMInverseScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~schedulers.scheduling_ddim_inverse.DDIMInverseSchedulerOutput</code> or
<code>tuple</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.27.0/src/diffusers/schedulers/scheduling_ddim_inverse.py#L289",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If return_dict is <code>True</code>, <code>~schedulers.scheduling_ddim_inverse.DDIMInverseSchedulerOutput</code> is
returned, otherwise a tuple is returned where the first element is the sample tensor.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~schedulers.scheduling_ddim_inverse.DDIMInverseSchedulerOutput</code> or <code>tuple</code></p>
`}}),{c(){p=i("meta"),A=o(),z=i("p"),V=o(),y(h.$$.fragment),k=o(),g=i("p"),g.innerHTML=re,O=o(),y(_.$$.fragment),R=o(),s=i("div"),y(v.$$.fragment),K=o(),x=i("p"),x.innerHTML=oe,Q=o(),M=i("p"),M.innerHTML=ae,X=o(),u=i("div"),y(D.$$.fragment),Y=o(),S=i("p"),S.textContent=ie,Z=o(),f=i("div"),y(b.$$.fragment),ee=o(),$=i("p"),$.textContent=de,te=o(),m=i("div"),y(I.$$.fragment),se=o(),T=i("p"),T.textContent=ce,U=o(),N=i("p"),this.h()},l(e){const r=ge("svelte-u9bgzb",document.head);p=d(r,"META",{name:!0,content:!0}),r.forEach(t),A=a(e),z=d(e,"P",{}),w(z).forEach(t),V=a(e),C(h.$$.fragment,e),k=a(e),g=d(e,"P",{"data-svelte-h":!0}),P(g)!=="svelte-1s84ru"&&(g.innerHTML=re),O=a(e),C(_.$$.fragment,e),R=a(e),s=d(e,"DIV",{class:!0});var c=w(s);C(v.$$.fragment,c),K=a(c),x=d(c,"P",{"data-svelte-h":!0}),P(x)!=="svelte-1wv3e37"&&(x.innerHTML=oe),Q=a(c),M=d(c,"P",{"data-svelte-h":!0}),P(M)!=="svelte-15wg2qx"&&(M.innerHTML=ae),X=a(c),u=d(c,"DIV",{class:!0});var j=w(u);C(D.$$.fragment,j),Y=a(j),S=d(j,"P",{"data-svelte-h":!0}),P(S)!=="svelte-1rkfgpx"&&(S.textContent=ie),j.forEach(t),Z=a(c),f=d(c,"DIV",{class:!0});var G=w(f);C(b.$$.fragment,G),ee=a(G),$=d(G,"P",{"data-svelte-h":!0}),P($)!=="svelte-1vzm9q"&&($.textContent=de),G.forEach(t),te=a(c),m=d(c,"DIV",{class:!0});var J=w(m);C(I.$$.fragment,J),se=a(J),T=d(J,"P",{"data-svelte-h":!0}),P(T)!=="svelte-hi84tp"&&(T.textContent=ce),J.forEach(t),c.forEach(t),U=a(e),N=d(e,"P",{}),w(N).forEach(t),this.h()},h(){E(p,"name","hf:doc:metadata"),E(p,"content",ve),E(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(s,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,r){n(document.head,p),l(e,A,r),l(e,z,r),l(e,V,r),F(h,e,r),l(e,k,r),l(e,g,r),l(e,O,r),F(_,e,r),l(e,R,r),l(e,s,r),F(v,s,null),n(s,K),n(s,x),n(s,Q),n(s,M),n(s,X),n(s,u),F(D,u,null),n(u,Y),n(u,S),n(s,Z),n(s,f),F(b,f,null),n(f,ee),n(f,$),n(s,te),n(s,m),F(I,m,null),n(m,se),n(m,T),l(e,U,r),l(e,N,r),W=!0},p:ue,i(e){W||(L(h.$$.fragment,e),L(_.$$.fragment,e),L(v.$$.fragment,e),L(D.$$.fragment,e),L(b.$$.fragment,e),L(I.$$.fragment,e),W=!0)},o(e){q(h.$$.fragment,e),q(_.$$.fragment,e),q(v.$$.fragment,e),q(D.$$.fragment,e),q(b.$$.fragment,e),q(I.$$.fragment,e),W=!1},d(e){e&&(t(A),t(z),t(V),t(k),t(g),t(O),t(R),t(s),t(U),t(N)),t(p),H(h,e),H(_,e),H(v),H(D),H(b),H(I)}}}const ve='{"title":"DDIMInverseScheduler","local":"ddiminversescheduler","sections":[{"title":"DDIMInverseScheduler","local":"diffusers.DDIMInverseScheduler","sections":[],"depth":2}],"depth":1}';function De(ne){return fe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Se extends me{constructor(p){super(),he(this,p,De,_e,pe,{})}}export{Se as component};
