import{s as It,n as St,o as qt}from"../chunks/scheduler.53228c21.js";import{S as Ct,i as Lt,e as i,s as o,c as p,h as Ut,a,d as s,b as r,f as M,g as u,j as c,k as b,l,m as n,n as m,t as f,o as h,p as g}from"../chunks/index.100fac89.js";import{C as Zt}from"../chunks/CopyLLMTxtMenu.999d3d86.js";import{D as se}from"../chunks/Docstring.46d0934e.js";import{C as me}from"../chunks/CodeBlock.d30a6509.js";import{H as Oe,E as Jt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.d27ae4df.js";function Vt(at){let v,fe,pe,he,L,ge,U,_e,Z,lt='<a href="https://huggingface.co/papers/2010.02502" rel="nofollow">Denoising Diffusion Implicit Models</a> (DDIM) by Jiaming Song, Chenlin Meng and Stefano Ermon.',be,J,dt="The abstract from the paper is:",ve,V,ct=`<em>Denoising diffusion probabilistic models (DDPMs) have achieved high quality image generation without adversarial training, yet they require simulating a Markov chain for many steps to produce a sample.
To accelerate sampling, we present denoising diffusion implicit models (DDIMs), a more efficient class of iterative implicit probabilistic models
with the same training procedure as DDPMs. In DDPMs, the generative process is defined as the reverse of a Markovian diffusion process.
We construct a class of non-Markovian diffusion processes that lead to the same training objective, but whose reverse process can be much faster to sample from.
We empirically demonstrate that DDIMs can produce high quality samples 10× to 50× faster in terms of wall-clock time compared to DDPMs, allow us to trade off computation for sample quality, and can perform semantically meaningful image interpolation directly in the latent space.</em>`,De,H,pt='The original codebase of this paper can be found at <a href="https://github.com/ermongroup/ddim" rel="nofollow">ermongroup/ddim</a>, and you can contact the author on <a href="https://tsong.me/" rel="nofollow">tsong.me</a>.',Me,j,ye,N,ut='The paper <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are Flawed</a> claims that a mismatch between the training and inference settings leads to suboptimal inference generation results for Stable Diffusion. To fix this, the authors propose:',Te,y,mt="<p>🧪 This is an experimental feature!</p>",$e,G,ft="<li>rescale the noise schedule to enforce zero terminal signal-to-noise ratio (SNR)</li>",xe,k,we,T,ht='<li>train a model with <code>v_prediction</code> (add the following argument to the <a href="https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image.py" rel="nofollow">train_text_to_image.py</a> or <a href="https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_lora.py" rel="nofollow">train_text_to_image_lora.py</a> scripts)</li>',Ie,W,Se,$,gt="<li>change the sampler to always start from the last timestep</li>",qe,R,Ce,x,_t="<li>rescale classifier-free guidance to prevent over-exposure</li>",Le,E,Ue,B,bt="For example:",Ze,P,Je,z,Ve,d,O,Ye,ne,vt=`<code>DDIMScheduler</code> extends the denoising procedure introduced in denoising diffusion probabilistic models (DDPMs) with
non-Markovian guidance.`,Qe,oe,Dt=`This model inherits from <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/main/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.`,Xe,w,Y,Fe,re,Mt=`Add noise to the original samples according to the noise magnitude at each timestep (this is the forward
diffusion process).`,Ae,I,Q,Ke,ie,yt="Compute the velocity prediction from the sample and noise according to the velocity formula.",et,S,X,tt,ae,Tt=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,st,q,F,nt,le,$t="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",ot,C,A,rt,de,xt=`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).`,He,K,je,D,ee,it,ce,wt="Output class for the scheduler’s <code>step</code> function output.",Ne,te,Ge,ue,ke;return L=new Zt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),U=new Oe({props:{title:"DDIMScheduler",local:"ddimscheduler",headingTag:"h1"}}),j=new Oe({props:{title:"Tips",local:"tips",headingTag:"h2"}}),k=new me({props:{code:"cGlwZS5zY2hlZHVsZXIlMjAlM0QlMjBERElNU2NoZWR1bGVyLmZyb21fY29uZmlnKHBpcGUuc2NoZWR1bGVyLmNvbmZpZyUyQyUyMHJlc2NhbGVfYmV0YXNfemVyb19zbnIlM0RUcnVlKQ==",highlighted:'pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config, rescale_betas_zero_snr=<span class="hljs-literal">True</span>)',wrap:!1}}),W=new me({props:{code:"LS1wcmVkaWN0aW9uX3R5cGUlM0QlMjJ2X3ByZWRpY3Rpb24lMjI=",highlighted:'--prediction_type=<span class="hljs-string">&quot;v_prediction&quot;</span>',wrap:!1}}),R=new me({props:{code:"cGlwZS5zY2hlZHVsZXIlMjAlM0QlMjBERElNU2NoZWR1bGVyLmZyb21fY29uZmlnKHBpcGUuc2NoZWR1bGVyLmNvbmZpZyUyQyUyMHRpbWVzdGVwX3NwYWNpbmclM0QlMjJ0cmFpbGluZyUyMik=",highlighted:'pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config, timestep_spacing=<span class="hljs-string">&quot;trailing&quot;</span>)',wrap:!1}}),E=new me({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUyQyUyMGd1aWRhbmNlX3Jlc2NhbGUlM0QwLjcpLmltYWdlcyU1QjAlNUQ=",highlighted:'image = pipe(prompt, guidance_rescale=<span class="hljs-number">0.7</span>).images[<span class="hljs-number">0</span>]',wrap:!1}}),P=new me({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTJDJTIwRERJTVNjaGVkdWxlciUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJwdHgwJTJGcHNldWRvLWpvdXJuZXktdjIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZS5zY2hlZHVsZXIlMjAlM0QlMjBERElNU2NoZWR1bGVyLmZyb21fY29uZmlnKCUwQSUyMCUyMCUyMCUyMHBpcGUuc2NoZWR1bGVyLmNvbmZpZyUyQyUyMHJlc2NhbGVfYmV0YXNfemVyb19zbnIlM0RUcnVlJTJDJTIwdGltZXN0ZXBfc3BhY2luZyUzRCUyMnRyYWlsaW5nJTIyJTBBKSUwQXBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwbGlvbiUyMGluJTIwZ2FsYXhpZXMlMkMlMjBzcGlyYWxzJTJDJTIwbmVidWxhZSUyQyUyMHN0YXJzJTJDJTIwc21va2UlMkMlMjBpcmlkZXNjZW50JTJDJTIwaW50cmljYXRlJTIwZGV0YWlsJTJDJTIwb2N0YW5lJTIwcmVuZGVyJTJDJTIwOGslMjIlMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTJDJTIwZ3VpZGFuY2VfcmVzY2FsZSUzRDAuNykuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline, DDIMScheduler
<span class="hljs-keyword">import</span> torch

pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;ptx0/pseudo-journey-v2&quot;</span>, torch_dtype=torch.float16)
pipe.scheduler = DDIMScheduler.from_config(
    pipe.scheduler.config, rescale_betas_zero_snr=<span class="hljs-literal">True</span>, timestep_spacing=<span class="hljs-string">&quot;trailing&quot;</span>
)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;A lion in galaxies, spirals, nebulae, stars, smoke, iridescent, intricate detail, octane render, 8k&quot;</span>
image = pipe(prompt, guidance_rescale=<span class="hljs-number">0.7</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),z=new Oe({props:{title:"DDIMScheduler",local:"diffusers.DDIMScheduler",headingTag:"h2"}}),O=new se({props:{name:"class diffusers.DDIMScheduler",anchor:"diffusers.DDIMScheduler",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:": typing.Literal['linear', 'scaled_linear', 'squaredcos_cap_v2'] = '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:": typing.Literal['epsilon', 'sample', 'v_prediction'] = 'epsilon'"},{name:"thresholding",val:": bool = False"},{name:"dynamic_thresholding_ratio",val:": float = 0.995"},{name:"clip_sample_range",val:": float = 1.0"},{name:"sample_max_value",val:": float = 1.0"},{name:"timestep_spacing",val:": typing.Literal['leading', 'trailing', 'linspace'] = 'leading'"},{name:"rescale_betas_zero_snr",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.DDIMScheduler.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.DDIMScheduler.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.DDIMScheduler.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.DDIMScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>Literal[&quot;linear&quot;, &quot;scaled_linear&quot;, &quot;squaredcos_cap_v2&quot;]</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. Must be one
of <code>&quot;linear&quot;</code>, <code>&quot;scaled_linear&quot;</code>, or <code>&quot;squaredcos_cap_v2&quot;</code>.`,name:"beta_schedule"},{anchor:"diffusers.DDIMScheduler.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.DDIMScheduler.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.DDIMScheduler.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.DDIMScheduler.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 <code>1</code>,
otherwise it uses the alpha value at step 0.`,name:"set_alpha_to_one"},{anchor:"diffusers.DDIMScheduler.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.DDIMScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>Literal[&quot;epsilon&quot;, &quot;sample&quot;, &quot;v_prediction&quot;]</code>, defaults to <code>&quot;epsilon&quot;</code>) &#x2014;
Prediction type of the scheduler function. Must be one of <code>&quot;epsilon&quot;</code> (predicts the noise of the diffusion
process), <code>&quot;sample&quot;</code> (directly predicts the noisy sample), or <code>&quot;v_prediction&quot;</code> (see section 2.4 of <a href="https://huggingface.co/papers/2210.02303" rel="nofollow">Imagen
Video</a> paper).`,name:"prediction_type"},{anchor:"diffusers.DDIMScheduler.thresholding",description:`<strong>thresholding</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to use the &#x201C;dynamic thresholding&#x201D; method. This is unsuitable for latent-space diffusion models such
as Stable Diffusion.`,name:"thresholding"},{anchor:"diffusers.DDIMScheduler.dynamic_thresholding_ratio",description:`<strong>dynamic_thresholding_ratio</strong> (<code>float</code>, defaults to 0.995) &#x2014;
The ratio for the dynamic thresholding method. Valid only when <code>thresholding=True</code>.`,name:"dynamic_thresholding_ratio"},{anchor:"diffusers.DDIMScheduler.sample_max_value",description:`<strong>sample_max_value</strong> (<code>float</code>, defaults to 1.0) &#x2014;
The threshold value for dynamic thresholding. Valid only when <code>thresholding=True</code>.`,name:"sample_max_value"},{anchor:"diffusers.DDIMScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>Literal[&quot;leading&quot;, &quot;trailing&quot;, &quot;linspace&quot;]</code>, defaults to <code>&quot;leading&quot;</code>) &#x2014;
The way the timesteps should be scaled. Must be one of <code>&quot;leading&quot;</code>, <code>&quot;trailing&quot;</code>, or <code>&quot;linspace&quot;</code>. 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.DDIMScheduler.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/main/src/diffusers/schedulers/scheduling_ddim.py#L132"}}),Y=new se({props:{name:"add_noise",anchor:"diffusers.DDIMScheduler.add_noise",parameters:[{name:"original_samples",val:": Tensor"},{name:"noise",val:": Tensor"},{name:"timesteps",val:": IntTensor"}],parametersDescription:[{anchor:"diffusers.DDIMScheduler.add_noise.original_samples",description:`<strong>original_samples</strong> (<code>torch.Tensor</code>) &#x2014;
The original samples to which noise will be added.`,name:"original_samples"},{anchor:"diffusers.DDIMScheduler.add_noise.noise",description:`<strong>noise</strong> (<code>torch.Tensor</code>) &#x2014;
The noise to add to the samples.`,name:"noise"},{anchor:"diffusers.DDIMScheduler.add_noise.timesteps",description:`<strong>timesteps</strong> (<code>torch.IntTensor</code>) &#x2014;
The timesteps indicating the noise level for each sample.`,name:"timesteps"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim.py#L510",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The noisy samples.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),Q=new se({props:{name:"get_velocity",anchor:"diffusers.DDIMScheduler.get_velocity",parameters:[{name:"sample",val:": Tensor"},{name:"noise",val:": Tensor"},{name:"timesteps",val:": IntTensor"}],parametersDescription:[{anchor:"diffusers.DDIMScheduler.get_velocity.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.DDIMScheduler.get_velocity.noise",description:`<strong>noise</strong> (<code>torch.Tensor</code>) &#x2014;
The noise tensor.`,name:"noise"},{anchor:"diffusers.DDIMScheduler.get_velocity.timesteps",description:`<strong>timesteps</strong> (<code>torch.IntTensor</code>) &#x2014;
The timesteps for velocity computation.`,name:"timesteps"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim.py#L553",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The computed velocity.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),X=new se({props:{name:"scale_model_input",anchor:"diffusers.DDIMScheduler.scale_model_input",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.DDIMScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.DDIMScheduler.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/main/src/diffusers/schedulers/scheduling_ddim.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.Tensor</code></p>
`}}),F=new se({props:{name:"set_timesteps",anchor:"diffusers.DDIMScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.DDIMScheduler.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"},{anchor:"diffusers.DDIMScheduler.set_timesteps.device",description:`<strong>device</strong> (<code>Union[str, torch.device]</code>, <em>optional</em>) &#x2014;
The device to use for the timesteps.`,name:"device"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim.py#L327",raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<ul>
<li><code>ValueError</code> — If <code>num_inference_steps</code> is larger than <code>self.config.num_train_timesteps</code>.</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>ValueError</code></p>
`}}),A=new se({props:{name:"step",anchor:"diffusers.DDIMScheduler.step",parameters:[{name:"model_output",val:": Tensor"},{name:"timestep",val:": int"},{name:"sample",val:": Tensor"},{name:"eta",val:": float = 0.0"},{name:"use_clipped_model_output",val:": bool = False"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"},{name:"variance_noise",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.DDIMScheduler.step.model_output",description:`<strong>model_output</strong> (<code>torch.Tensor</code>) &#x2014;
The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.DDIMScheduler.step.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.DDIMScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
A current instance of a sample created by the diffusion process.`,name:"sample"},{anchor:"diffusers.DDIMScheduler.step.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The weight of noise for added noise in diffusion step. A value of 0 corresponds to DDIM (deterministic)
and 1 corresponds to DDPM (fully stochastic).`,name:"eta"},{anchor:"diffusers.DDIMScheduler.step.use_clipped_model_output",description:`<strong>use_clipped_model_output</strong> (<code>bool</code>, <em>optional</em>, 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.DDIMScheduler.step.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
A random number generator for reproducible sampling.`,name:"generator"},{anchor:"diffusers.DDIMScheduler.step.variance_noise",description:`<strong>variance_noise</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#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.DDIMScheduler.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 <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.schedulers.scheduling_ddim.DDIMSchedulerOutput">DDIMSchedulerOutput</a> or <code>tuple</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim.py#L377",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If return_dict is <code>True</code>, <a
  href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.schedulers.scheduling_ddim.DDIMSchedulerOutput"
>DDIMSchedulerOutput</a> 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><a
  href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.schedulers.scheduling_ddim.DDIMSchedulerOutput"
>DDIMSchedulerOutput</a> or <code>tuple</code></p>
`}}),K=new Oe({props:{title:"DDIMSchedulerOutput",local:"diffusers.schedulers.scheduling_ddim.DDIMSchedulerOutput",headingTag:"h2"}}),ee=new se({props:{name:"class diffusers.schedulers.scheduling_ddim.DDIMSchedulerOutput",anchor:"diffusers.schedulers.scheduling_ddim.DDIMSchedulerOutput",parameters:[{name:"prev_sample",val:": Tensor"},{name:"pred_original_sample",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"diffusers.schedulers.scheduling_ddim.DDIMSchedulerOutput.prev_sample",description:`<strong>prev_sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code> for images) &#x2014;
Computed sample <code>(x_{t-1})</code> of previous timestep. <code>prev_sample</code> should be used as next model input in the
denoising loop.`,name:"prev_sample"},{anchor:"diffusers.schedulers.scheduling_ddim.DDIMSchedulerOutput.pred_original_sample",description:`<strong>pred_original_sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code> for images) &#x2014;
The predicted denoised sample <code>(x_{0})</code> based on the model output from the current timestep.
<code>pred_original_sample</code> can be used to preview progress or for guidance.`,name:"pred_original_sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim.py#L33"}}),te=new Jt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/ddim.md"}}),{c(){v=i("meta"),fe=o(),pe=i("p"),he=o(),p(L.$$.fragment),ge=o(),p(U.$$.fragment),_e=o(),Z=i("p"),Z.innerHTML=lt,be=o(),J=i("p"),J.textContent=dt,ve=o(),V=i("p"),V.innerHTML=ct,De=o(),H=i("p"),H.innerHTML=pt,Me=o(),p(j.$$.fragment),ye=o(),N=i("p"),N.innerHTML=ut,Te=o(),y=i("blockquote"),y.innerHTML=mt,$e=o(),G=i("ol"),G.innerHTML=ft,xe=o(),p(k.$$.fragment),we=o(),T=i("ol"),T.innerHTML=ht,Ie=o(),p(W.$$.fragment),Se=o(),$=i("ol"),$.innerHTML=gt,qe=o(),p(R.$$.fragment),Ce=o(),x=i("ol"),x.innerHTML=_t,Le=o(),p(E.$$.fragment),Ue=o(),B=i("p"),B.textContent=bt,Ze=o(),p(P.$$.fragment),Je=o(),p(z.$$.fragment),Ve=o(),d=i("div"),p(O.$$.fragment),Ye=o(),ne=i("p"),ne.innerHTML=vt,Qe=o(),oe=i("p"),oe.innerHTML=Dt,Xe=o(),w=i("div"),p(Y.$$.fragment),Fe=o(),re=i("p"),re.textContent=Mt,Ae=o(),I=i("div"),p(Q.$$.fragment),Ke=o(),ie=i("p"),ie.textContent=yt,et=o(),S=i("div"),p(X.$$.fragment),tt=o(),ae=i("p"),ae.textContent=Tt,st=o(),q=i("div"),p(F.$$.fragment),nt=o(),le=i("p"),le.textContent=$t,ot=o(),C=i("div"),p(A.$$.fragment),rt=o(),de=i("p"),de.textContent=xt,He=o(),p(K.$$.fragment),je=o(),D=i("div"),p(ee.$$.fragment),it=o(),ce=i("p"),ce.innerHTML=wt,Ne=o(),p(te.$$.fragment),Ge=o(),ue=i("p"),this.h()},l(e){const t=Ut("svelte-u9bgzb",document.head);v=a(t,"META",{name:!0,content:!0}),t.forEach(s),fe=r(e),pe=a(e,"P",{}),M(pe).forEach(s),he=r(e),u(L.$$.fragment,e),ge=r(e),u(U.$$.fragment,e),_e=r(e),Z=a(e,"P",{"data-svelte-h":!0}),c(Z)!=="svelte-1qeb1a3"&&(Z.innerHTML=lt),be=r(e),J=a(e,"P",{"data-svelte-h":!0}),c(J)!=="svelte-1cwsb16"&&(J.textContent=dt),ve=r(e),V=a(e,"P",{"data-svelte-h":!0}),c(V)!=="svelte-1h59s10"&&(V.innerHTML=ct),De=r(e),H=a(e,"P",{"data-svelte-h":!0}),c(H)!=="svelte-1stib0u"&&(H.innerHTML=pt),Me=r(e),u(j.$$.fragment,e),ye=r(e),N=a(e,"P",{"data-svelte-h":!0}),c(N)!=="svelte-nsfv69"&&(N.innerHTML=ut),Te=r(e),y=a(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),c(y)!=="svelte-gdt3xk"&&(y.innerHTML=mt),$e=r(e),G=a(e,"OL",{"data-svelte-h":!0}),c(G)!=="svelte-hhk4t"&&(G.innerHTML=ft),xe=r(e),u(k.$$.fragment,e),we=r(e),T=a(e,"OL",{start:!0,"data-svelte-h":!0}),c(T)!=="svelte-18uxl2t"&&(T.innerHTML=ht),Ie=r(e),u(W.$$.fragment,e),Se=r(e),$=a(e,"OL",{start:!0,"data-svelte-h":!0}),c($)!=="svelte-17ct3yw"&&($.innerHTML=gt),qe=r(e),u(R.$$.fragment,e),Ce=r(e),x=a(e,"OL",{start:!0,"data-svelte-h":!0}),c(x)!=="svelte-1a6ampg"&&(x.innerHTML=_t),Le=r(e),u(E.$$.fragment,e),Ue=r(e),B=a(e,"P",{"data-svelte-h":!0}),c(B)!=="svelte-1gkqha7"&&(B.textContent=bt),Ze=r(e),u(P.$$.fragment,e),Je=r(e),u(z.$$.fragment,e),Ve=r(e),d=a(e,"DIV",{class:!0});var _=M(d);u(O.$$.fragment,_),Ye=r(_),ne=a(_,"P",{"data-svelte-h":!0}),c(ne)!=="svelte-1wae91k"&&(ne.innerHTML=vt),Qe=r(_),oe=a(_,"P",{"data-svelte-h":!0}),c(oe)!=="svelte-linuuh"&&(oe.innerHTML=Dt),Xe=r(_),w=a(_,"DIV",{class:!0});var We=M(w);u(Y.$$.fragment,We),Fe=r(We),re=a(We,"P",{"data-svelte-h":!0}),c(re)!=="svelte-hqmiev"&&(re.textContent=Mt),We.forEach(s),Ae=r(_),I=a(_,"DIV",{class:!0});var Re=M(I);u(Q.$$.fragment,Re),Ke=r(Re),ie=a(Re,"P",{"data-svelte-h":!0}),c(ie)!=="svelte-1aqw5k3"&&(ie.textContent=yt),Re.forEach(s),et=r(_),S=a(_,"DIV",{class:!0});var Ee=M(S);u(X.$$.fragment,Ee),tt=r(Ee),ae=a(Ee,"P",{"data-svelte-h":!0}),c(ae)!=="svelte-1rkfgpx"&&(ae.textContent=Tt),Ee.forEach(s),st=r(_),q=a(_,"DIV",{class:!0});var Be=M(q);u(F.$$.fragment,Be),nt=r(Be),le=a(Be,"P",{"data-svelte-h":!0}),c(le)!=="svelte-1vzm9q"&&(le.textContent=$t),Be.forEach(s),ot=r(_),C=a(_,"DIV",{class:!0});var Pe=M(C);u(A.$$.fragment,Pe),rt=r(Pe),de=a(Pe,"P",{"data-svelte-h":!0}),c(de)!=="svelte-hi84tp"&&(de.textContent=xt),Pe.forEach(s),_.forEach(s),He=r(e),u(K.$$.fragment,e),je=r(e),D=a(e,"DIV",{class:!0});var ze=M(D);u(ee.$$.fragment,ze),it=r(ze),ce=a(ze,"P",{"data-svelte-h":!0}),c(ce)!=="svelte-id9kic"&&(ce.innerHTML=wt),ze.forEach(s),Ne=r(e),u(te.$$.fragment,e),Ge=r(e),ue=a(e,"P",{}),M(ue).forEach(s),this.h()},h(){b(v,"name","hf:doc:metadata"),b(v,"content",Ht),b(y,"class","warning"),b(T,"start","2"),b($,"start","3"),b(x,"start","4"),b(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(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(e,t){l(document.head,v),n(e,fe,t),n(e,pe,t),n(e,he,t),m(L,e,t),n(e,ge,t),m(U,e,t),n(e,_e,t),n(e,Z,t),n(e,be,t),n(e,J,t),n(e,ve,t),n(e,V,t),n(e,De,t),n(e,H,t),n(e,Me,t),m(j,e,t),n(e,ye,t),n(e,N,t),n(e,Te,t),n(e,y,t),n(e,$e,t),n(e,G,t),n(e,xe,t),m(k,e,t),n(e,we,t),n(e,T,t),n(e,Ie,t),m(W,e,t),n(e,Se,t),n(e,$,t),n(e,qe,t),m(R,e,t),n(e,Ce,t),n(e,x,t),n(e,Le,t),m(E,e,t),n(e,Ue,t),n(e,B,t),n(e,Ze,t),m(P,e,t),n(e,Je,t),m(z,e,t),n(e,Ve,t),n(e,d,t),m(O,d,null),l(d,Ye),l(d,ne),l(d,Qe),l(d,oe),l(d,Xe),l(d,w),m(Y,w,null),l(w,Fe),l(w,re),l(d,Ae),l(d,I),m(Q,I,null),l(I,Ke),l(I,ie),l(d,et),l(d,S),m(X,S,null),l(S,tt),l(S,ae),l(d,st),l(d,q),m(F,q,null),l(q,nt),l(q,le),l(d,ot),l(d,C),m(A,C,null),l(C,rt),l(C,de),n(e,He,t),m(K,e,t),n(e,je,t),n(e,D,t),m(ee,D,null),l(D,it),l(D,ce),n(e,Ne,t),m(te,e,t),n(e,Ge,t),n(e,ue,t),ke=!0},p:St,i(e){ke||(f(L.$$.fragment,e),f(U.$$.fragment,e),f(j.$$.fragment,e),f(k.$$.fragment,e),f(W.$$.fragment,e),f(R.$$.fragment,e),f(E.$$.fragment,e),f(P.$$.fragment,e),f(z.$$.fragment,e),f(O.$$.fragment,e),f(Y.$$.fragment,e),f(Q.$$.fragment,e),f(X.$$.fragment,e),f(F.$$.fragment,e),f(A.$$.fragment,e),f(K.$$.fragment,e),f(ee.$$.fragment,e),f(te.$$.fragment,e),ke=!0)},o(e){h(L.$$.fragment,e),h(U.$$.fragment,e),h(j.$$.fragment,e),h(k.$$.fragment,e),h(W.$$.fragment,e),h(R.$$.fragment,e),h(E.$$.fragment,e),h(P.$$.fragment,e),h(z.$$.fragment,e),h(O.$$.fragment,e),h(Y.$$.fragment,e),h(Q.$$.fragment,e),h(X.$$.fragment,e),h(F.$$.fragment,e),h(A.$$.fragment,e),h(K.$$.fragment,e),h(ee.$$.fragment,e),h(te.$$.fragment,e),ke=!1},d(e){e&&(s(fe),s(pe),s(he),s(ge),s(_e),s(Z),s(be),s(J),s(ve),s(V),s(De),s(H),s(Me),s(ye),s(N),s(Te),s(y),s($e),s(G),s(xe),s(we),s(T),s(Ie),s(Se),s($),s(qe),s(Ce),s(x),s(Le),s(Ue),s(B),s(Ze),s(Je),s(Ve),s(d),s(He),s(je),s(D),s(Ne),s(Ge),s(ue)),s(v),g(L,e),g(U,e),g(j,e),g(k,e),g(W,e),g(R,e),g(E,e),g(P,e),g(z,e),g(O),g(Y),g(Q),g(X),g(F),g(A),g(K,e),g(ee),g(te,e)}}}const Ht='{"title":"DDIMScheduler","local":"ddimscheduler","sections":[{"title":"Tips","local":"tips","sections":[],"depth":2},{"title":"DDIMScheduler","local":"diffusers.DDIMScheduler","sections":[],"depth":2},{"title":"DDIMSchedulerOutput","local":"diffusers.schedulers.scheduling_ddim.DDIMSchedulerOutput","sections":[],"depth":2}],"depth":1}';function jt(at){return qt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Bt extends Ct{constructor(v){super(),Lt(this,v,jt,Vt,It,{})}}export{Bt as component};
