Buckets:
| import{s as fe,n as me,o as he}from"../chunks/scheduler.182ea377.js";import{S as ge,i as _e,g as a,s as r,r as C,A as be,h as d,f as t,c as i,j as k,u as S,x as I,k as q,y as o,a as l,v as L,d as $,t as T,w}from"../chunks/index.abf12888.js";import{D as B}from"../chunks/Docstring.93f6f462.js";import{H as re}from"../chunks/Heading.16916d63.js";function ve(ie){let p,O,N,V,h,A,g,W,_,ae=`Multistep and onestep scheduler (Algorithm 3) introduced alongside latent consistency models in the paper <a href="https://arxiv.org/abs/2310.04378" rel="nofollow">Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference</a> by Simian Luo, Yiqin Tan, Longbo Huang, Jian Li, and Hang Zhao. | |
| This scheduler should be able to generate good samples from <a href="/docs/diffusers/main/en/api/pipelines/latent_consistency_models#diffusers.LatentConsistencyModelPipeline">LatentConsistencyModelPipeline</a> in 1-8 steps.`,R,b,U,n,v,K,D,de=`<code>LCMScheduler</code> extends the denoising procedure introduced in denoising diffusion probabilistic models (DDPMs) with | |
| non-Markovian guidance.`,Q,P,ce=`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>. <a href="/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin">~ConfigMixin</a> takes care of storing all config | |
| attributes that are passed in the scheduler’s <code>__init__</code> function, such as <code>num_train_timesteps</code>. They can be | |
| accessed via <code>scheduler.config.num_train_timesteps</code>. <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> provides general loading and saving | |
| functionality via the <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained">SchedulerMixin.save_pretrained()</a> and <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained">from_pretrained()</a> functions.`,X,u,x,ee,F,le=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the | |
| current timestep.`,te,f,y,ne,E,pe="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",se,m,M,oe,H,ue=`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).`,G,z,Y;return h=new re({props:{title:"Latent Consistency Model Multistep Scheduler",local:"latent-consistency-model-multistep-scheduler",headingTag:"h1"}}),g=new re({props:{title:"Overview",local:"overview",headingTag:"h2"}}),b=new re({props:{title:"LCMScheduler",local:"diffusers.LCMScheduler",headingTag:"h2"}}),v=new B({props:{name:"class diffusers.LCMScheduler",anchor:"diffusers.LCMScheduler",parameters:[{name:"num_train_timesteps",val:": int = 1000"},{name:"beta_start",val:": float = 0.00085"},{name:"beta_end",val:": float = 0.012"},{name:"beta_schedule",val:": str = 'scaled_linear'"},{name:"trained_betas",val:": typing.Union[numpy.ndarray, typing.List[float], NoneType] = None"},{name:"original_inference_steps",val:": int = 50"},{name:"clip_sample",val:": bool = False"},{name:"clip_sample_range",val:": float = 1.0"},{name:"set_alpha_to_one",val:": bool = True"},{name:"steps_offset",val:": int = 0"},{name:"prediction_type",val:": str = 'epsilon'"},{name:"thresholding",val:": bool = False"},{name:"dynamic_thresholding_ratio",val:": float = 0.995"},{name:"sample_max_value",val:": float = 1.0"},{name:"timestep_spacing",val:": str = 'leading'"},{name:"rescale_betas_zero_snr",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.LCMScheduler.num_train_timesteps",description:`<strong>num_train_timesteps</strong> (<code>int</code>, defaults to 1000) — | |
| The number of diffusion steps to train the model.`,name:"num_train_timesteps"},{anchor:"diffusers.LCMScheduler.beta_start",description:`<strong>beta_start</strong> (<code>float</code>, defaults to 0.0001) — | |
| The starting <code>beta</code> value of inference.`,name:"beta_start"},{anchor:"diffusers.LCMScheduler.beta_end",description:`<strong>beta_end</strong> (<code>float</code>, defaults to 0.02) — | |
| The final <code>beta</code> value.`,name:"beta_end"},{anchor:"diffusers.LCMScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>str</code>, defaults to <code>"linear"</code>) — | |
| 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.LCMScheduler.trained_betas",description:`<strong>trained_betas</strong> (<code>np.ndarray</code>, <em>optional</em>) — | |
| 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.LCMScheduler.original_inference_steps",description:`<strong>original_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) — | |
| The default number of inference steps used to generate a linearly-spaced timestep schedule, from which we | |
| will ultimately take <code>num_inference_steps</code> evenly spaced timesteps to form the final timestep schedule.`,name:"original_inference_steps"},{anchor:"diffusers.LCMScheduler.clip_sample",description:`<strong>clip_sample</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Clip the predicted sample for numerical stability.`,name:"clip_sample"},{anchor:"diffusers.LCMScheduler.clip_sample_range",description:`<strong>clip_sample_range</strong> (<code>float</code>, defaults to 1.0) — | |
| The maximum magnitude for sample clipping. Valid only when <code>clip_sample=True</code>.`,name:"clip_sample_range"},{anchor:"diffusers.LCMScheduler.set_alpha_to_one",description:`<strong>set_alpha_to_one</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| 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.LCMScheduler.steps_offset",description:`<strong>steps_offset</strong> (<code>int</code>, defaults to 0) — | |
| 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 like in Stable | |
| Diffusion.`,name:"steps_offset"},{anchor:"diffusers.LCMScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, defaults to <code>epsilon</code>, <em>optional</em>) — | |
| 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.LCMScheduler.thresholding",description:`<strong>thresholding</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| Whether to use the “dynamic thresholding” method. This is unsuitable for latent-space diffusion models such | |
| as Stable Diffusion.`,name:"thresholding"},{anchor:"diffusers.LCMScheduler.dynamic_thresholding_ratio",description:`<strong>dynamic_thresholding_ratio</strong> (<code>float</code>, defaults to 0.995) — | |
| The ratio for the dynamic thresholding method. Valid only when <code>thresholding=True</code>.`,name:"dynamic_thresholding_ratio"},{anchor:"diffusers.LCMScheduler.sample_max_value",description:`<strong>sample_max_value</strong> (<code>float</code>, defaults to 1.0) — | |
| The threshold value for dynamic thresholding. Valid only when <code>thresholding=True</code>.`,name:"sample_max_value"},{anchor:"diffusers.LCMScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>str</code>, defaults to <code>"leading"</code>) — | |
| 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.LCMScheduler.rescale_betas_zero_snr",description:`<strong>rescale_betas_zero_snr</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| 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_lcm.py#L134"}}),x=new B({props:{name:"scale_model_input",anchor:"diffusers.LCMScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.LCMScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) — | |
| The input sample.`,name:"sample"},{anchor:"diffusers.LCMScheduler.scale_model_input.timestep",description:`<strong>timestep</strong> (<code>int</code>, <em>optional</em>) — | |
| The current timestep in the diffusion chain.`,name:"timestep"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_lcm.py#L272",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> | |
| `}}),y=new B({props:{name:"set_timesteps",anchor:"diffusers.LCMScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"},{name:"original_inference_steps",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.LCMScheduler.set_timesteps.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>) — | |
| The number of diffusion steps used when generating samples with a pre-trained model.`,name:"num_inference_steps"},{anchor:"diffusers.LCMScheduler.set_timesteps.device",description:`<strong>device</strong> (<code>str</code> or <code>torch.device</code>, <em>optional</em>) — | |
| The device to which the timesteps should be moved to. If <code>None</code>, the timesteps are not moved.`,name:"device"},{anchor:"diffusers.LCMScheduler.set_timesteps.original_inference_steps",description:`<strong>original_inference_steps</strong> (<code>int</code>, <em>optional</em>) — | |
| The original number of inference steps, which will be used to generate a linearly-spaced timestep | |
| schedule (which is different from the standard <code>diffusers</code> implementation). We will then take | |
| <code>num_inference_steps</code> timesteps from this schedule, evenly spaced in terms of indices, and use that as | |
| our final timestep schedule. If not set, this will default to the <code>original_inference_steps</code> attribute.`,name:"original_inference_steps"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_lcm.py#L322"}}),M=new B({props:{name:"step",anchor:"diffusers.LCMScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.LCMScheduler.step.model_output",description:`<strong>model_output</strong> (<code>torch.FloatTensor</code>) — | |
| The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.LCMScheduler.step.timestep",description:`<strong>timestep</strong> (<code>float</code>) — | |
| The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.LCMScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) — | |
| A current instance of a sample created by the diffusion process.`,name:"sample"},{anchor:"diffusers.LCMScheduler.step.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) — | |
| A random number generator.`,name:"generator"},{anchor:"diffusers.LCMScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <code>LCMSchedulerOutput</code> or <code>tuple</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_lcm.py#L390",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If return_dict is <code>True</code>, <code>LCMSchedulerOutput</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_utils.LCMSchedulerOutput</code> or <code>tuple</code></p> | |
| `}}),{c(){p=a("meta"),O=r(),N=a("p"),V=r(),C(h.$$.fragment),A=r(),C(g.$$.fragment),W=r(),_=a("p"),_.innerHTML=ae,R=r(),C(b.$$.fragment),U=r(),n=a("div"),C(v.$$.fragment),K=r(),D=a("p"),D.innerHTML=de,Q=r(),P=a("p"),P.innerHTML=ce,X=r(),u=a("div"),C(x.$$.fragment),ee=r(),F=a("p"),F.textContent=le,te=r(),f=a("div"),C(y.$$.fragment),ne=r(),E=a("p"),E.textContent=pe,se=r(),m=a("div"),C(M.$$.fragment),oe=r(),H=a("p"),H.textContent=ue,G=r(),z=a("p"),this.h()},l(e){const s=be("svelte-u9bgzb",document.head);p=d(s,"META",{name:!0,content:!0}),s.forEach(t),O=i(e),N=d(e,"P",{}),k(N).forEach(t),V=i(e),S(h.$$.fragment,e),A=i(e),S(g.$$.fragment,e),W=i(e),_=d(e,"P",{"data-svelte-h":!0}),I(_)!=="svelte-1hnnbn8"&&(_.innerHTML=ae),R=i(e),S(b.$$.fragment,e),U=i(e),n=d(e,"DIV",{class:!0});var c=k(n);S(v.$$.fragment,c),K=i(c),D=d(c,"P",{"data-svelte-h":!0}),I(D)!=="svelte-1cn3gww"&&(D.innerHTML=de),Q=i(c),P=d(c,"P",{"data-svelte-h":!0}),I(P)!=="svelte-1wfw14k"&&(P.innerHTML=ce),X=i(c),u=d(c,"DIV",{class:!0});var j=k(u);S(x.$$.fragment,j),ee=i(j),F=d(j,"P",{"data-svelte-h":!0}),I(F)!=="svelte-1rkfgpx"&&(F.textContent=le),j.forEach(t),te=i(c),f=d(c,"DIV",{class:!0});var J=k(f);S(y.$$.fragment,J),ne=i(J),E=d(J,"P",{"data-svelte-h":!0}),I(E)!=="svelte-1vzm9q"&&(E.textContent=pe),J.forEach(t),se=i(c),m=d(c,"DIV",{class:!0});var Z=k(m);S(M.$$.fragment,Z),oe=i(Z),H=d(Z,"P",{"data-svelte-h":!0}),I(H)!=="svelte-hi84tp"&&(H.textContent=ue),Z.forEach(t),c.forEach(t),G=i(e),z=d(e,"P",{}),k(z).forEach(t),this.h()},h(){q(p,"name","hf:doc:metadata"),q(p,"content",xe),q(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(n,"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,s){o(document.head,p),l(e,O,s),l(e,N,s),l(e,V,s),L(h,e,s),l(e,A,s),L(g,e,s),l(e,W,s),l(e,_,s),l(e,R,s),L(b,e,s),l(e,U,s),l(e,n,s),L(v,n,null),o(n,K),o(n,D),o(n,Q),o(n,P),o(n,X),o(n,u),L(x,u,null),o(u,ee),o(u,F),o(n,te),o(n,f),L(y,f,null),o(f,ne),o(f,E),o(n,se),o(n,m),L(M,m,null),o(m,oe),o(m,H),l(e,G,s),l(e,z,s),Y=!0},p:me,i(e){Y||($(h.$$.fragment,e),$(g.$$.fragment,e),$(b.$$.fragment,e),$(v.$$.fragment,e),$(x.$$.fragment,e),$(y.$$.fragment,e),$(M.$$.fragment,e),Y=!0)},o(e){T(h.$$.fragment,e),T(g.$$.fragment,e),T(b.$$.fragment,e),T(v.$$.fragment,e),T(x.$$.fragment,e),T(y.$$.fragment,e),T(M.$$.fragment,e),Y=!1},d(e){e&&(t(O),t(N),t(V),t(A),t(W),t(_),t(R),t(U),t(n),t(G),t(z)),t(p),w(h,e),w(g,e),w(b,e),w(v),w(x),w(y),w(M)}}}const xe='{"title":"Latent Consistency Model Multistep Scheduler","local":"latent-consistency-model-multistep-scheduler","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"LCMScheduler","local":"diffusers.LCMScheduler","sections":[],"depth":2}],"depth":1}';function ye(ie){return he(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $e extends ge{constructor(p){super(),_e(this,p,ye,ve,fe,{})}}export{$e as component}; | |
Xet Storage Details
- Size:
- 16.9 kB
- Xet hash:
- 11f14dcc38eb2c70e9270e1a0df3b9b03a47e91fd67e27c25af8b6c9ec7075af
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.