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 r,r as T,A as _e,h as d,f as t,c as a,j as w,u as C,x as F,k as P,y as n,a as l,v as L,d as E,t as q,w as z}from"../chunks/index.abf12888.js";import{D as Y}from"../chunks/Docstring.93f6f462.js";import{H as le}from"../chunks/Heading.16916d63.js";function ge(ne){let p,k,N,A,h,V,_,oe=`<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.pdf" rel="nofollow">Null-text Inversion for Editing Real Images using Guided Diffusion Models</a>.`,O,g,R,s,v,B,x,re='<code>DDIMInverseScheduler</code> is the reverse scheduler of <a href="/docs/diffusers/v0.23.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>.',K,M,ae=`This model inherits from <a href="/docs/diffusers/v0.23.0/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/v0.23.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.`,Q,u,D,X,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,y,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,H,W;return h=new le({props:{title:"DDIMInverseScheduler",local:"ddiminversescheduler",headingTag:"h1"}}),g=new le({props:{title:"DDIMInverseScheduler",local:"diffusers.DDIMInverseScheduler",headingTag:"h2"}}),v=new Y({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'"},{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. You can use a combination of <code>offset=1</code> and
<code>set_alpha_to_one=False</code> to make the last step use <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>, 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.23.0/src/diffusers/schedulers/scheduling_ddim_inverse.py#L130"}}),D=new Y({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;
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.23.0/src/diffusers/schedulers/scheduling_ddim_inverse.py#L238",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 Y({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.23.0/src/diffusers/schedulers/scheduling_ddim_inverse.py#L255"}}),I=new Y({props:{name:"step",anchor:"diffusers.DDIMInverseScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"eta",val:": float = 0.0"},{name:"use_clipped_model_output",val:": bool = False"},{name:"variance_noise",val:": typing.Optional[torch.FloatTensor] = None"},{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.23.0/src/diffusers/schedulers/scheduling_ddim_inverse.py#L293",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"),k=r(),N=i("p"),A=r(),T(h.$$.fragment),V=r(),_=i("p"),_.innerHTML=oe,O=r(),T(g.$$.fragment),R=r(),s=i("div"),T(v.$$.fragment),B=r(),x=i("p"),x.innerHTML=re,K=r(),M=i("p"),M.innerHTML=ae,Q=r(),u=i("div"),T(D.$$.fragment),X=r(),S=i("p"),S.textContent=ie,Z=r(),f=i("div"),T(b.$$.fragment),ee=r(),$=i("p"),$.textContent=de,te=r(),m=i("div"),T(I.$$.fragment),se=r(),y=i("p"),y.textContent=ce,U=r(),H=i("p"),this.h()},l(e){const o=_e("svelte-u9bgzb",document.head);p=d(o,"META",{name:!0,content:!0}),o.forEach(t),k=a(e),N=d(e,"P",{}),w(N).forEach(t),A=a(e),C(h.$$.fragment,e),V=a(e),_=d(e,"P",{"data-svelte-h":!0}),F(_)!=="svelte-1h2rvze"&&(_.innerHTML=oe),O=a(e),C(g.$$.fragment,e),R=a(e),s=d(e,"DIV",{class:!0});var c=w(s);C(v.$$.fragment,c),B=a(c),x=d(c,"P",{"data-svelte-h":!0}),F(x)!=="svelte-13qvxnz"&&(x.innerHTML=re),K=a(c),M=d(c,"P",{"data-svelte-h":!0}),F(M)!=="svelte-1aejr5d"&&(M.innerHTML=ae),Q=a(c),u=d(c,"DIV",{class:!0});var j=w(u);C(D.$$.fragment,j),X=a(j),S=d(j,"P",{"data-svelte-h":!0}),F(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}),F($)!=="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),y=d(J,"P",{"data-svelte-h":!0}),F(y)!=="svelte-hi84tp"&&(y.textContent=ce),J.forEach(t),c.forEach(t),U=a(e),H=d(e,"P",{}),w(H).forEach(t),this.h()},h(){P(p,"name","hf:doc:metadata"),P(p,"content",ve),P(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(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,o){n(document.head,p),l(e,k,o),l(e,N,o),l(e,A,o),L(h,e,o),l(e,V,o),l(e,_,o),l(e,O,o),L(g,e,o),l(e,R,o),l(e,s,o),L(v,s,null),n(s,B),n(s,x),n(s,K),n(s,M),n(s,Q),n(s,u),L(D,u,null),n(u,X),n(u,S),n(s,Z),n(s,f),L(b,f,null),n(f,ee),n(f,$),n(s,te),n(s,m),L(I,m,null),n(m,se),n(m,y),l(e,U,o),l(e,H,o),W=!0},p:ue,i(e){W||(E(h.$$.fragment,e),E(g.$$.fragment,e),E(v.$$.fragment,e),E(D.$$.fragment,e),E(b.$$.fragment,e),E(I.$$.fragment,e),W=!0)},o(e){q(h.$$.fragment,e),q(g.$$.fragment,e),q(v.$$.fragment,e),q(D.$$.fragment,e),q(b.$$.fragment,e),q(I.$$.fragment,e),W=!1},d(e){e&&(t(k),t(N),t(A),t(V),t(_),t(O),t(R),t(s),t(U),t(H)),t(p),z(h,e),z(g,e),z(v),z(D),z(b),z(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,ge,pe,{})}}export{Se as component};
