import{S as vn,i as Mn,s as Jn,e as l,k as c,w as M,t as o,M as Tn,c as a,d as t,m as p,a as n,x as J,h as i,b as r,G as e,g as m,y as T,q as E,o as j,B as I,v as En,L as jn}from"../../../chunks/vendor-hf-doc-builder.js";import{D as ms}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as da}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as hs}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as In}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Un(It){let _,$,y,b,Z;return b=new da({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQ29uc2lzdGVuY3lNb2RlbFBpcGVsaW5lJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUwQSUyMyUyMExvYWQlMjB0aGUlMjBjZF9pbWFnZW5ldDY0X2wyJTIwY2hlY2twb2ludC4lMEFtb2RlbF9pZF9vcl9wYXRoJTIwJTNEJTIwJTIyb3BlbmFpJTJGZGlmZnVzZXJzLWNkX2ltYWdlbmV0NjRfbDIlMjIlMEFwaXBlJTIwJTNEJTIwQ29uc2lzdGVuY3lNb2RlbFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZF9vcl9wYXRoJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUudG8oZGV2aWNlKSUwQSUwQSUyMyUyME9uZXN0ZXAlMjBTYW1wbGluZyUwQWltYWdlJTIwJTNEJTIwcGlwZShudW1faW5mZXJlbmNlX3N0ZXBzJTNEMSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyY2RfaW1hZ2VuZXQ2NF9sMl9vbmVzdGVwX3NhbXBsZS5wbmclMjIpJTBBJTBBJTIzJTIwT25lc3RlcCUyMHNhbXBsaW5nJTJDJTIwY2xhc3MtY29uZGl0aW9uYWwlMjBpbWFnZSUyMGdlbmVyYXRpb24lMEElMjMlMjBJbWFnZU5ldC02NCUyMGNsYXNzJTIwbGFiZWwlMjAxNDUlMjBjb3JyZXNwb25kcyUyMHRvJTIwa2luZyUyMHBlbmd1aW5zJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QxJTJDJTIwY2xhc3NfbGFiZWxzJTNEMTQ1KS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSglMjJjZF9pbWFnZW5ldDY0X2wyX29uZXN0ZXBfc2FtcGxlX3Blbmd1aW4ucG5nJTIyKSUwQSUwQSUyMyUyME11bHRpc3RlcCUyMHNhbXBsaW5nJTJDJTIwY2xhc3MtY29uZGl0aW9uYWwlMjBpbWFnZSUyMGdlbmVyYXRpb24lMEElMjMlMjBUaW1lc3RlcHMlMjBjYW4lMjBiZSUyMGV4cGxpY2l0bHklMjBzcGVjaWZpZWQlM0IlMjB0aGUlMjBwYXJ0aWN1bGFyJTIwdGltZXN0ZXBzJTIwYmVsb3clMjBhcmUlMjBmcm9tJTIwdGhlJTIwb3JpZ2luYWwlMjBHaXRodWIlMjByZXBvJTNBJTBBJTIzJTIwaHR0cHMlM0ElMkYlMkZnaXRodWIuY29tJTJGb3BlbmFpJTJGY29uc2lzdGVuY3lfbW9kZWxzJTJGYmxvYiUyRm1haW4lMkZzY3JpcHRzJTJGbGF1bmNoLnNoJTIzTDc3JTBBaW1hZ2UlMjAlM0QlMjBwaXBlKG51bV9pbmZlcmVuY2Vfc3RlcHMlM0ROb25lJTJDJTIwdGltZXN0ZXBzJTNEJTVCMjIlMkMlMjAwJTVEJTJDJTIwY2xhc3NfbGFiZWxzJTNEMTQ1KS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSglMjJjZF9pbWFnZW5ldDY0X2wyX211bHRpc3RlcF9zYW1wbGVfcGVuZ3Vpbi5wbmclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ConsistencyModelPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load the cd_imagenet64_l2 checkpoint.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model_id_or_path = <span class="hljs-string">&quot;openai/diffusers-cd_imagenet64_l2&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = ConsistencyModelPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(device)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Onestep Sampling</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(num_inference_steps=<span class="hljs-number">1</span>).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;cd_imagenet64_l2_onestep_sample.png&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Onestep sampling, class-conditional image generation</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># ImageNet-64 class label 145 corresponds to king penguins</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(num_inference_steps=<span class="hljs-number">1</span>, class_labels=<span class="hljs-number">145</span>).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;cd_imagenet64_l2_onestep_sample_penguin.png&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Multistep sampling, class-conditional image generation</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Timesteps can be explicitly specified; the particular timesteps below are from the original Github repo:</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># https://github.com/openai/consistency_models/blob/main/scripts/launch.sh#L77</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(num_inference_steps=<span class="hljs-literal">None</span>, timesteps=[<span class="hljs-number">22</span>, <span class="hljs-number">0</span>], class_labels=<span class="hljs-number">145</span>).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;cd_imagenet64_l2_multistep_sample_penguin.png&quot;</span>)`}}),{c(){_=l("p"),$=o("Examples:"),y=c(),M(b.$$.fragment)},l(h){_=a(h,"P",{});var W=n(_);$=i(W,"Examples:"),W.forEach(t),y=p(h),J(b.$$.fragment,h)},m(h,W){m(h,_,W),e(_,$),m(h,y,W),T(b,h,W),Z=!0},p:jn,i(h){Z||(E(b.$$.fragment,h),Z=!0)},o(h){j(b.$$.fragment,h),Z=!1},d(h){h&&t(_),h&&t(y),I(b,h)}}}function Gn(It){let _,$,y,b,Z,h,W,He,fs,Ut,V,us,K,gs,_s,Gt,X,bs,ee,ys,ws,Zt,Ye,Le,vs,Wt,ke,Ms,Bt,z,qe,te,Js,Ts,Oe,se,Es,Ct,$e,js,Nt,f,le,Ke,Is,Us,ae,Gs,Zs,ne,et,Ws,Bs,oe,Cs,Ns,ie,tt,xs,Ys,re,ks,$s,ce,st,Vs,Xs,pe,zs,Ps,de,lt,Rs,Fs,me,Ss,Ds,he,at,Qs,As,fe,Hs,Ls,ue,nt,qs,Os,ge,Ks,el,_e,ot,tl,sl,be,ll,al,ye,it,nl,ol,we,il,xt,N,P,rt,ve,rl,ct,cl,Yt,R,pt,U,Ve,pl,dl,Xe,ml,hl,ze,fl,ul,Pe,gl,_l,dt,G,Re,Me,bl,yl,Fe,mt,wl,vl,ht,Ml,ft,kt,B,Jl,Je,Tl,El,Te,jl,Il,$t,x,F,ut,Ee,Ul,gt,Gl,Vt,je,Xt,S,Zl,_t,Wl,Bl,zt,Ie,Pt,Y,D,bt,Ue,Cl,yt,Nl,Rt,u,Ge,xl,wt,Yl,kl,Ze,$l,Se,Vl,Xl,zl,De,Pl,We,Rl,Fl,Q,Be,Sl,A,Dl,H,Ce,Ql,v,Al,vt,Hl,Ll,Mt,ql,Ol,Jt,Kl,ea,Tt,ta,sa,la,L,Ne,aa,k,na,Et,oa,ia,jt,ra,ca,Ft;return h=new hs({}),ve=new hs({}),Ee=new hs({}),je=new da({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQ29uc2lzdGVuY3lNb2RlbFBpcGVsaW5lJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUwQSUyMyUyMExvYWQlMjB0aGUlMjBjZF9pbWFnZW5ldDY0X2wyJTIwY2hlY2twb2ludC4lMEFtb2RlbF9pZF9vcl9wYXRoJTIwJTNEJTIwJTIyb3BlbmFpJTJGZGlmZnVzZXJzLWNkX2ltYWdlbmV0NjRfbDIlMjIlMEFwaXBlJTIwJTNEJTIwQ29uc2lzdGVuY3lNb2RlbFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZF9vcl9wYXRoJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUudG8oZGV2aWNlKSUwQSUwQSUyMyUyME9uZXN0ZXAlMjBTYW1wbGluZyUwQWltYWdlJTIwJTNEJTIwcGlwZShudW1faW5mZXJlbmNlX3N0ZXBzJTNEMSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyY29uc2lzdGVuY3lfbW9kZWxfb25lc3RlcF9zYW1wbGUucG5nJTIyKSUwQSUwQSUyMyUyME9uZXN0ZXAlMjBzYW1wbGluZyUyQyUyMGNsYXNzLWNvbmRpdGlvbmFsJTIwaW1hZ2UlMjBnZW5lcmF0aW9uJTBBJTIzJTIwSW1hZ2VOZXQtNjQlMjBjbGFzcyUyMGxhYmVsJTIwMTQ1JTIwY29ycmVzcG9uZHMlMjB0byUyMGtpbmclMjBwZW5ndWlucyUwQWltYWdlJTIwJTNEJTIwcGlwZShudW1faW5mZXJlbmNlX3N0ZXBzJTNEMSUyQyUyMGNsYXNzX2xhYmVscyUzRDE0NSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyY29uc2lzdGVuY3lfbW9kZWxfb25lc3RlcF9zYW1wbGVfcGVuZ3Vpbi5wbmclMjIpJTBBJTBBJTIzJTIwTXVsdGlzdGVwJTIwc2FtcGxpbmclMkMlMjBjbGFzcy1jb25kaXRpb25hbCUyMGltYWdlJTIwZ2VuZXJhdGlvbiUwQSUyMyUyMFRpbWVzdGVwcyUyMGNhbiUyMGJlJTIwZXhwbGljaXRseSUyMHNwZWNpZmllZCUzQiUyMHRoZSUyMHBhcnRpY3VsYXIlMjB0aW1lc3RlcHMlMjBiZWxvdyUyMGFyZSUyMGZyb20lMjB0aGUlMjBvcmlnaW5hbCUyMEdpdGh1YiUyMHJlcG8uJTBBJTIzJTIwaHR0cHMlM0ElMkYlMkZnaXRodWIuY29tJTJGb3BlbmFpJTJGY29uc2lzdGVuY3lfbW9kZWxzJTJGYmxvYiUyRm1haW4lMkZzY3JpcHRzJTJGbGF1bmNoLnNoJTIzTDc3JTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHRpbWVzdGVwcyUzRCU1QjIyJTJDJTIwMCU1RCUyQyUyMGNsYXNzX2xhYmVscyUzRDE0NSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyY29uc2lzdGVuY3lfbW9kZWxfbXVsdGlzdGVwX3NhbXBsZV9wZW5ndWluLnBuZyUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ConsistencyModelPipeline

device = <span class="hljs-string">&quot;cuda&quot;</span>
<span class="hljs-comment"># Load the cd_imagenet64_l2 checkpoint.</span>
model_id_or_path = <span class="hljs-string">&quot;openai/diffusers-cd_imagenet64_l2&quot;</span>
pipe = ConsistencyModelPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
pipe.to(device)

<span class="hljs-comment"># Onestep Sampling</span>
image = pipe(num_inference_steps=<span class="hljs-number">1</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;consistency_model_onestep_sample.png&quot;</span>)

<span class="hljs-comment"># Onestep sampling, class-conditional image generation</span>
<span class="hljs-comment"># ImageNet-64 class label 145 corresponds to king penguins</span>
image = pipe(num_inference_steps=<span class="hljs-number">1</span>, class_labels=<span class="hljs-number">145</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;consistency_model_onestep_sample_penguin.png&quot;</span>)

<span class="hljs-comment"># Multistep sampling, class-conditional image generation</span>
<span class="hljs-comment"># Timesteps can be explicitly specified; the particular timesteps below are from the original Github repo.</span>
<span class="hljs-comment"># https://github.com/openai/consistency_models/blob/main/scripts/launch.sh#L77</span>
image = pipe(timesteps=[<span class="hljs-number">22</span>, <span class="hljs-number">0</span>], class_labels=<span class="hljs-number">145</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;consistency_model_multistep_sample_penguin.png&quot;</span>)`}}),Ie=new da({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQ29uc2lzdGVuY3lNb2RlbFBpcGVsaW5lJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUwQSUyMyUyMExvYWQlMjB0aGUlMjBjZF9iZWRyb29tMjU2X2xwaXBzJTIwY2hlY2twb2ludC4lMEFtb2RlbF9pZF9vcl9wYXRoJTIwJTNEJTIwJTIyb3BlbmFpJTJGZGlmZnVzZXJzLWNkX2JlZHJvb20yNTZfbHBpcHMlMjIlMEFwaXBlJTIwJTNEJTIwQ29uc2lzdGVuY3lNb2RlbFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZF9vcl9wYXRoJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUudG8oZGV2aWNlKSUwQSUwQXBpcGUudW5ldCUyMCUzRCUyMHRvcmNoLmNvbXBpbGUocGlwZS51bmV0JTJDJTIwbW9kZSUzRCUyMnJlZHVjZS1vdmVyaGVhZCUyMiUyQyUyMGZ1bGxncmFwaCUzRFRydWUpJTBBJTBBJTIzJTIwTXVsdGlzdGVwJTIwc2FtcGxpbmclMEElMjMlMjBUaW1lc3RlcHMlMjBjYW4lMjBiZSUyMGV4cGxpY2l0bHklMjBzcGVjaWZpZWQlM0IlMjB0aGUlMjBwYXJ0aWN1bGFyJTIwdGltZXN0ZXBzJTIwYmVsb3clMjBhcmUlMjBmcm9tJTIwdGhlJTIwb3JpZ2luYWwlMjBHaXRodWIlMjByZXBvJTNBJTBBJTIzJTIwaHR0cHMlM0ElMkYlMkZnaXRodWIuY29tJTJGb3BlbmFpJTJGY29uc2lzdGVuY3lfbW9kZWxzJTJGYmxvYiUyRm1haW4lMkZzY3JpcHRzJTJGbGF1bmNoLnNoJTIzTDgzJTBBZm9yJTIwXyUyMGluJTIwcmFuZ2UoMTApJTNBJTBBJTIwJTIwJTIwJTIwaW1hZ2UlMjAlM0QlMjBwaXBlKHRpbWVzdGVwcyUzRCU1QjE3JTJDJTIwMCU1RCkuaW1hZ2VzJTVCMCU1RCUwQSUyMCUyMCUyMCUyMGltYWdlLnNob3coKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ConsistencyModelPipeline

device = <span class="hljs-string">&quot;cuda&quot;</span>
<span class="hljs-comment"># Load the cd_bedroom256_lpips checkpoint.</span>
model_id_or_path = <span class="hljs-string">&quot;openai/diffusers-cd_bedroom256_lpips&quot;</span>
pipe = ConsistencyModelPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
pipe.to(device)

pipe.unet = torch.<span class="hljs-built_in">compile</span>(pipe.unet, mode=<span class="hljs-string">&quot;reduce-overhead&quot;</span>, fullgraph=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># Multistep sampling</span>
<span class="hljs-comment"># Timesteps can be explicitly specified; the particular timesteps below are from the original Github repo:</span>
<span class="hljs-comment"># https://github.com/openai/consistency_models/blob/main/scripts/launch.sh#L83</span>
<span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">10</span>):
    image = pipe(timesteps=[<span class="hljs-number">17</span>, <span class="hljs-number">0</span>]).images[<span class="hljs-number">0</span>]
    image.show()`}}),Ue=new hs({}),Ge=new ms({props:{name:"class diffusers.ConsistencyModelPipeline",anchor:"diffusers.ConsistencyModelPipeline",parameters:[{name:"unet",val:": UNet2DModel"},{name:"scheduler",val:": CMStochasticIterativeScheduler"}],parametersDescription:[{anchor:"diffusers.ConsistencyModelPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/unet2d#diffusers.UNet2DModel">UNet2DModel</a>) &#x2014;
Unconditional or class-conditional U-Net architecture to denoise image latents.`,name:"unet"},{anchor:"diffusers.ConsistencyModelPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.2/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the image latents. Currently only compatible
with <a href="/docs/diffusers/v0.18.2/en/api/schedulers/cm_stochastic_iterative#diffusers.CMStochasticIterativeScheduler">CMStochasticIterativeScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/consistency_models/pipeline_consistency_models.py#L51"}}),Be=new ms({props:{name:"__call__",anchor:"diffusers.ConsistencyModelPipeline.__call__",parameters:[{name:"batch_size",val:": int = 1"},{name:"class_labels",val:": typing.Union[torch.Tensor, typing.List[int], int, NoneType] = None"},{name:"num_inference_steps",val:": int = 1"},{name:"timesteps",val:": typing.List[int] = None"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"}],parametersDescription:[{anchor:"diffusers.ConsistencyModelPipeline.__call__.batch_size",description:`<strong>batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate.`,name:"batch_size"},{anchor:"diffusers.ConsistencyModelPipeline.__call__.class_labels",description:`<strong>class_labels</strong> (<code>torch.Tensor</code> or <code>List[int]</code> or <code>int</code>, <em>optional</em>) &#x2014;
Optional class labels for conditioning class-conditional consistency models. Will not be used if the
model is not class-conditional.`,name:"class_labels"},{anchor:"diffusers.ConsistencyModelPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.ConsistencyModelPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.ConsistencyModelPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.ConsistencyModelPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.ConsistencyModelPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.ConsistencyModelPipeline.__call__.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/v0.18.2/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.ConsistencyModelPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.ConsistencyModelPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/consistency_models/pipeline_consistency_models.py#L228",returnDescription:`
<p><code>~pipelines.utils.ImagePipelineOutput</code> if <code>return_dict</code> is
True, otherwise a \`tuple. When returning a tuple, the first element is a list with the generated images.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/v0.18.2/en/api/outputs#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),A=new In({props:{anchor:"diffusers.ConsistencyModelPipeline.__call__.example",$$slots:{default:[Un]},$$scope:{ctx:It}}}),Ce=new ms({props:{name:"enable_model_cpu_offload",anchor:"diffusers.ConsistencyModelPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/consistency_models/pipeline_consistency_models.py#L104"}}),Ne=new ms({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.ConsistencyModelPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/consistency_models/pipeline_consistency_models.py#L79"}}),{c(){_=l("meta"),$=c(),y=l("h1"),b=l("a"),Z=l("span"),M(h.$$.fragment),W=c(),He=l("span"),fs=o("Consistency Models"),Ut=c(),V=l("p"),us=o("Consistency Models were proposed in "),K=l("a"),gs=o("Consistency Models"),_s=o(" by Yang Song, Prafulla Dhariwal, Mark Chen, and Ilya Sutskever."),Gt=c(),X=l("p"),bs=o("The abstract of the "),ee=l("a"),ys=o("paper"),ws=o(" is as follows:"),Zt=c(),Ye=l("p"),Le=l("em"),vs=o("Diffusion models have significantly advanced the fields of image, audio, and video generation, but they depend on an iterative sampling process that causes slow generation. To overcome this limitation, we propose consistency models, a new family of models that generate high quality samples by directly mapping noise to data. They support fast one-step generation by design, while still allowing multistep sampling to trade compute for sample quality. They also support zero-shot data editing, such as image inpainting, colorization, and super-resolution, without requiring explicit training on these tasks. Consistency models can be trained either by distilling pre-trained diffusion models, or as standalone generative models altogether. Through extensive experiments, we demonstrate that they outperform existing distillation techniques for diffusion models in one- and few-step sampling, achieving the new state-of-the-art FID of 3.55 on CIFAR-10 and 6.20 on ImageNet 64x64 for one-step generation. When trained in isolation, consistency models become a new family of generative models that can outperform existing one-step, non-adversarial generative models on standard benchmarks such as CIFAR-10, ImageNet 64x64 and LSUN 256x256."),Wt=c(),ke=l("p"),Ms=o("Resources:"),Bt=c(),z=l("ul"),qe=l("li"),te=l("a"),Js=o("Paper"),Ts=c(),Oe=l("li"),se=l("a"),Es=o("Original Code"),Ct=c(),$e=l("p"),js=o("Available Checkpoints are:"),Nt=c(),f=l("ul"),le=l("li"),Ke=l("em"),Is=o("cd_imagenet64_l2 (64x64 resolution)"),Us=c(),ae=l("a"),Gs=o("openai/consistency-model-pipelines"),Zs=c(),ne=l("li"),et=l("em"),Ws=o("cd_imagenet64_lpips (64x64 resolution)"),Bs=c(),oe=l("a"),Cs=o("openai/diffusers-cd_imagenet64_lpips"),Ns=c(),ie=l("li"),tt=l("em"),xs=o("ct_imagenet64 (64x64 resolution)"),Ys=c(),re=l("a"),ks=o("openai/diffusers-ct_imagenet64"),$s=c(),ce=l("li"),st=l("em"),Vs=o("cd_bedroom256_l2 (256x256 resolution)"),Xs=c(),pe=l("a"),zs=o("openai/diffusers-cd_bedroom256_l2"),Ps=c(),de=l("li"),lt=l("em"),Rs=o("cd_bedroom256_lpips (256x256 resolution)"),Fs=c(),me=l("a"),Ss=o("openai/diffusers-cd_bedroom256_lpips"),Ds=c(),he=l("li"),at=l("em"),Qs=o("ct_bedroom256 (256x256 resolution)"),As=c(),fe=l("a"),Hs=o("openai/diffusers-ct_bedroom256"),Ls=c(),ue=l("li"),nt=l("em"),qs=o("cd_cat256_l2 (256x256 resolution)"),Os=c(),ge=l("a"),Ks=o("openai/diffusers-cd_cat256_l2"),el=c(),_e=l("li"),ot=l("em"),tl=o("cd_cat256_lpips (256x256 resolution)"),sl=c(),be=l("a"),ll=o("openai/diffusers-cd_cat256_lpips"),al=c(),ye=l("li"),it=l("em"),nl=o("ct_cat256 (256x256 resolution)"),ol=c(),we=l("a"),il=o("openai/diffusers-ct_cat256"),xt=c(),N=l("h2"),P=l("a"),rt=l("span"),M(ve.$$.fragment),rl=c(),ct=l("span"),cl=o("Available Pipelines"),Yt=c(),R=l("table"),pt=l("thead"),U=l("tr"),Ve=l("th"),pl=o("Pipeline"),dl=c(),Xe=l("th"),ml=o("Tasks"),hl=c(),ze=l("th"),fl=o("Demo"),ul=c(),Pe=l("th"),gl=o("Colab"),_l=c(),dt=l("tbody"),G=l("tr"),Re=l("td"),Me=l("a"),bl=o("ConsistencyModelPipeline"),yl=c(),Fe=l("td"),mt=l("em"),wl=o("Unconditional Image Generation"),vl=c(),ht=l("td"),Ml=c(),ft=l("td"),kt=c(),B=l("p"),Jl=o("This pipeline was contributed by our community members "),Je=l("a"),Tl=o("dg845"),El=o(" and "),Te=l("a"),jl=o("ayushtues"),Il=o(" \u2764\uFE0F"),$t=c(),x=l("h2"),F=l("a"),ut=l("span"),M(Ee.$$.fragment),Ul=c(),gt=l("span"),Gl=o("Usage Example"),Vt=c(),M(je.$$.fragment),Xt=c(),S=l("p"),Zl=o("For an additional speed-up, one can also make use of "),_t=l("code"),Wl=o("torch.compile"),Bl=o(". Multiple images can be generated in <1 second as follows:"),zt=c(),M(Ie.$$.fragment),Pt=c(),Y=l("h2"),D=l("a"),bt=l("span"),M(Ue.$$.fragment),Cl=c(),yt=l("span"),Nl=o("ConsistencyModelPipeline"),Rt=c(),u=l("div"),M(Ge.$$.fragment),xl=c(),wt=l("p"),Yl=o("Pipeline for consistency models for unconditional or class-conditional image generation, as introduced in [1]."),kl=c(),Ze=l("p"),$l=o("This model inherits from "),Se=l("a"),Vl=o("DiffusionPipeline"),Xl=o(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),zl=c(),De=l("p"),Pl=o(`[1] Song, Yang and Dhariwal, Prafulla and Chen, Mark and Sutskever, Ilya. \u201CConsistency Models\u201D
`),We=l("a"),Rl=o("https://arxiv.org/pdf/2303.01469"),Fl=c(),Q=l("div"),M(Be.$$.fragment),Sl=c(),M(A.$$.fragment),Dl=c(),H=l("div"),M(Ce.$$.fragment),Ql=c(),v=l("p"),Al=o(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),vt=l("code"),Hl=o("enable_sequential_cpu_offload"),Ll=o(", this method moves one whole model at a time to the GPU when its "),Mt=l("code"),ql=o("forward"),Ol=o(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Jt=l("code"),Kl=o("enable_sequential_cpu_offload"),ea=o(", but performance is much better due to the iterative execution of the "),Tt=l("code"),ta=o("unet"),sa=o("."),la=c(),L=l("div"),M(Ne.$$.fragment),aa=c(),k=l("p"),na=o(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),Et=l("code"),oa=o("torch.device('meta') and loaded to GPU only when their specific submodule has its "),ia=o("forward"),jt=l("code"),ra=o("method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),ca=o("enable_model_cpu_offload`, but performance is lower."),this.h()},l(s){const d=Tn('[data-svelte="svelte-1phssyn"]',document.head);_=a(d,"META",{name:!0,content:!0}),d.forEach(t),$=p(s),y=a(s,"H1",{class:!0});var xe=n(y);b=a(xe,"A",{id:!0,class:!0,href:!0});var ma=n(b);Z=a(ma,"SPAN",{});var ha=n(Z);J(h.$$.fragment,ha),ha.forEach(t),ma.forEach(t),W=p(xe),He=a(xe,"SPAN",{});var fa=n(He);fs=i(fa,"Consistency Models"),fa.forEach(t),xe.forEach(t),Ut=p(s),V=a(s,"P",{});var St=n(V);us=i(St,"Consistency Models were proposed in "),K=a(St,"A",{href:!0,rel:!0});var ua=n(K);gs=i(ua,"Consistency Models"),ua.forEach(t),_s=i(St," by Yang Song, Prafulla Dhariwal, Mark Chen, and Ilya Sutskever."),St.forEach(t),Gt=p(s),X=a(s,"P",{});var Dt=n(X);bs=i(Dt,"The abstract of the "),ee=a(Dt,"A",{href:!0,rel:!0});var ga=n(ee);ys=i(ga,"paper"),ga.forEach(t),ws=i(Dt," is as follows:"),Dt.forEach(t),Zt=p(s),Ye=a(s,"P",{});var _a=n(Ye);Le=a(_a,"EM",{});var ba=n(Le);vs=i(ba,"Diffusion models have significantly advanced the fields of image, audio, and video generation, but they depend on an iterative sampling process that causes slow generation. To overcome this limitation, we propose consistency models, a new family of models that generate high quality samples by directly mapping noise to data. They support fast one-step generation by design, while still allowing multistep sampling to trade compute for sample quality. They also support zero-shot data editing, such as image inpainting, colorization, and super-resolution, without requiring explicit training on these tasks. Consistency models can be trained either by distilling pre-trained diffusion models, or as standalone generative models altogether. Through extensive experiments, we demonstrate that they outperform existing distillation techniques for diffusion models in one- and few-step sampling, achieving the new state-of-the-art FID of 3.55 on CIFAR-10 and 6.20 on ImageNet 64x64 for one-step generation. When trained in isolation, consistency models become a new family of generative models that can outperform existing one-step, non-adversarial generative models on standard benchmarks such as CIFAR-10, ImageNet 64x64 and LSUN 256x256."),ba.forEach(t),_a.forEach(t),Wt=p(s),ke=a(s,"P",{});var ya=n(ke);Ms=i(ya,"Resources:"),ya.forEach(t),Bt=p(s),z=a(s,"UL",{});var Qt=n(z);qe=a(Qt,"LI",{});var wa=n(qe);te=a(wa,"A",{href:!0,rel:!0});var va=n(te);Js=i(va,"Paper"),va.forEach(t),wa.forEach(t),Ts=p(Qt),Oe=a(Qt,"LI",{});var Ma=n(Oe);se=a(Ma,"A",{href:!0,rel:!0});var Ja=n(se);Es=i(Ja,"Original Code"),Ja.forEach(t),Ma.forEach(t),Qt.forEach(t),Ct=p(s),$e=a(s,"P",{});var Ta=n($e);js=i(Ta,"Available Checkpoints are:"),Ta.forEach(t),Nt=p(s),f=a(s,"UL",{});var g=n(f);le=a(g,"LI",{});var At=n(le);Ke=a(At,"EM",{});var Ea=n(Ke);Is=i(Ea,"cd_imagenet64_l2 (64x64 resolution)"),Ea.forEach(t),Us=p(At),ae=a(At,"A",{href:!0,rel:!0});var ja=n(ae);Gs=i(ja,"openai/consistency-model-pipelines"),ja.forEach(t),At.forEach(t),Zs=p(g),ne=a(g,"LI",{});var Ht=n(ne);et=a(Ht,"EM",{});var Ia=n(et);Ws=i(Ia,"cd_imagenet64_lpips (64x64 resolution)"),Ia.forEach(t),Bs=p(Ht),oe=a(Ht,"A",{href:!0,rel:!0});var Ua=n(oe);Cs=i(Ua,"openai/diffusers-cd_imagenet64_lpips"),Ua.forEach(t),Ht.forEach(t),Ns=p(g),ie=a(g,"LI",{});var Lt=n(ie);tt=a(Lt,"EM",{});var Ga=n(tt);xs=i(Ga,"ct_imagenet64 (64x64 resolution)"),Ga.forEach(t),Ys=p(Lt),re=a(Lt,"A",{href:!0,rel:!0});var Za=n(re);ks=i(Za,"openai/diffusers-ct_imagenet64"),Za.forEach(t),Lt.forEach(t),$s=p(g),ce=a(g,"LI",{});var qt=n(ce);st=a(qt,"EM",{});var Wa=n(st);Vs=i(Wa,"cd_bedroom256_l2 (256x256 resolution)"),Wa.forEach(t),Xs=p(qt),pe=a(qt,"A",{href:!0,rel:!0});var Ba=n(pe);zs=i(Ba,"openai/diffusers-cd_bedroom256_l2"),Ba.forEach(t),qt.forEach(t),Ps=p(g),de=a(g,"LI",{});var Ot=n(de);lt=a(Ot,"EM",{});var Ca=n(lt);Rs=i(Ca,"cd_bedroom256_lpips (256x256 resolution)"),Ca.forEach(t),Fs=p(Ot),me=a(Ot,"A",{href:!0,rel:!0});var Na=n(me);Ss=i(Na,"openai/diffusers-cd_bedroom256_lpips"),Na.forEach(t),Ot.forEach(t),Ds=p(g),he=a(g,"LI",{});var Kt=n(he);at=a(Kt,"EM",{});var xa=n(at);Qs=i(xa,"ct_bedroom256 (256x256 resolution)"),xa.forEach(t),As=p(Kt),fe=a(Kt,"A",{href:!0,rel:!0});var Ya=n(fe);Hs=i(Ya,"openai/diffusers-ct_bedroom256"),Ya.forEach(t),Kt.forEach(t),Ls=p(g),ue=a(g,"LI",{});var es=n(ue);nt=a(es,"EM",{});var ka=n(nt);qs=i(ka,"cd_cat256_l2 (256x256 resolution)"),ka.forEach(t),Os=p(es),ge=a(es,"A",{href:!0,rel:!0});var $a=n(ge);Ks=i($a,"openai/diffusers-cd_cat256_l2"),$a.forEach(t),es.forEach(t),el=p(g),_e=a(g,"LI",{});var ts=n(_e);ot=a(ts,"EM",{});var Va=n(ot);tl=i(Va,"cd_cat256_lpips (256x256 resolution)"),Va.forEach(t),sl=p(ts),be=a(ts,"A",{href:!0,rel:!0});var Xa=n(be);ll=i(Xa,"openai/diffusers-cd_cat256_lpips"),Xa.forEach(t),ts.forEach(t),al=p(g),ye=a(g,"LI",{});var ss=n(ye);it=a(ss,"EM",{});var za=n(it);nl=i(za,"ct_cat256 (256x256 resolution)"),za.forEach(t),ol=p(ss),we=a(ss,"A",{href:!0,rel:!0});var Pa=n(we);il=i(Pa,"openai/diffusers-ct_cat256"),Pa.forEach(t),ss.forEach(t),g.forEach(t),xt=p(s),N=a(s,"H2",{class:!0});var ls=n(N);P=a(ls,"A",{id:!0,class:!0,href:!0});var Ra=n(P);rt=a(Ra,"SPAN",{});var Fa=n(rt);J(ve.$$.fragment,Fa),Fa.forEach(t),Ra.forEach(t),rl=p(ls),ct=a(ls,"SPAN",{});var Sa=n(ct);cl=i(Sa,"Available Pipelines"),Sa.forEach(t),ls.forEach(t),Yt=p(s),R=a(s,"TABLE",{});var as=n(R);pt=a(as,"THEAD",{});var Da=n(pt);U=a(Da,"TR",{});var q=n(U);Ve=a(q,"TH",{align:!0});var Qa=n(Ve);pl=i(Qa,"Pipeline"),Qa.forEach(t),dl=p(q),Xe=a(q,"TH",{align:!0});var Aa=n(Xe);ml=i(Aa,"Tasks"),Aa.forEach(t),hl=p(q),ze=a(q,"TH",{align:!0});var Ha=n(ze);fl=i(Ha,"Demo"),Ha.forEach(t),ul=p(q),Pe=a(q,"TH",{align:!0});var La=n(Pe);gl=i(La,"Colab"),La.forEach(t),q.forEach(t),Da.forEach(t),_l=p(as),dt=a(as,"TBODY",{});var qa=n(dt);G=a(qa,"TR",{});var O=n(G);Re=a(O,"TD",{align:!0});var Oa=n(Re);Me=a(Oa,"A",{href:!0,rel:!0});var Ka=n(Me);bl=i(Ka,"ConsistencyModelPipeline"),Ka.forEach(t),Oa.forEach(t),yl=p(O),Fe=a(O,"TD",{align:!0});var en=n(Fe);mt=a(en,"EM",{});var tn=n(mt);wl=i(tn,"Unconditional Image Generation"),tn.forEach(t),en.forEach(t),vl=p(O),ht=a(O,"TD",{align:!0}),n(ht).forEach(t),Ml=p(O),ft=a(O,"TD",{align:!0}),n(ft).forEach(t),O.forEach(t),qa.forEach(t),as.forEach(t),kt=p(s),B=a(s,"P",{});var Qe=n(B);Jl=i(Qe,"This pipeline was contributed by our community members "),Je=a(Qe,"A",{href:!0,rel:!0});var sn=n(Je);Tl=i(sn,"dg845"),sn.forEach(t),El=i(Qe," and "),Te=a(Qe,"A",{href:!0,rel:!0});var ln=n(Te);jl=i(ln,"ayushtues"),ln.forEach(t),Il=i(Qe," \u2764\uFE0F"),Qe.forEach(t),$t=p(s),x=a(s,"H2",{class:!0});var ns=n(x);F=a(ns,"A",{id:!0,class:!0,href:!0});var an=n(F);ut=a(an,"SPAN",{});var nn=n(ut);J(Ee.$$.fragment,nn),nn.forEach(t),an.forEach(t),Ul=p(ns),gt=a(ns,"SPAN",{});var on=n(gt);Gl=i(on,"Usage Example"),on.forEach(t),ns.forEach(t),Vt=p(s),J(je.$$.fragment,s),Xt=p(s),S=a(s,"P",{});var os=n(S);Zl=i(os,"For an additional speed-up, one can also make use of "),_t=a(os,"CODE",{});var rn=n(_t);Wl=i(rn,"torch.compile"),rn.forEach(t),Bl=i(os,". Multiple images can be generated in <1 second as follows:"),os.forEach(t),zt=p(s),J(Ie.$$.fragment,s),Pt=p(s),Y=a(s,"H2",{class:!0});var is=n(Y);D=a(is,"A",{id:!0,class:!0,href:!0});var cn=n(D);bt=a(cn,"SPAN",{});var pn=n(bt);J(Ue.$$.fragment,pn),pn.forEach(t),cn.forEach(t),Cl=p(is),yt=a(is,"SPAN",{});var dn=n(yt);Nl=i(dn,"ConsistencyModelPipeline"),dn.forEach(t),is.forEach(t),Rt=p(s),u=a(s,"DIV",{class:!0});var w=n(u);J(Ge.$$.fragment,w),xl=p(w),wt=a(w,"P",{});var mn=n(wt);Yl=i(mn,"Pipeline for consistency models for unconditional or class-conditional image generation, as introduced in [1]."),mn.forEach(t),kl=p(w),Ze=a(w,"P",{});var rs=n(Ze);$l=i(rs,"This model inherits from "),Se=a(rs,"A",{href:!0});var hn=n(Se);Vl=i(hn,"DiffusionPipeline"),hn.forEach(t),Xl=i(rs,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),rs.forEach(t),zl=p(w),De=a(w,"P",{});var pa=n(De);Pl=i(pa,`[1] Song, Yang and Dhariwal, Prafulla and Chen, Mark and Sutskever, Ilya. \u201CConsistency Models\u201D
`),We=a(pa,"A",{href:!0,rel:!0});var fn=n(We);Rl=i(fn,"https://arxiv.org/pdf/2303.01469"),fn.forEach(t),pa.forEach(t),Fl=p(w),Q=a(w,"DIV",{class:!0});var cs=n(Q);J(Be.$$.fragment,cs),Sl=p(cs),J(A.$$.fragment,cs),cs.forEach(t),Dl=p(w),H=a(w,"DIV",{class:!0});var ps=n(H);J(Ce.$$.fragment,ps),Ql=p(ps),v=a(ps,"P",{});var C=n(v);Al=i(C,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),vt=a(C,"CODE",{});var un=n(vt);Hl=i(un,"enable_sequential_cpu_offload"),un.forEach(t),Ll=i(C,", this method moves one whole model at a time to the GPU when its "),Mt=a(C,"CODE",{});var gn=n(Mt);ql=i(gn,"forward"),gn.forEach(t),Ol=i(C,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Jt=a(C,"CODE",{});var _n=n(Jt);Kl=i(_n,"enable_sequential_cpu_offload"),_n.forEach(t),ea=i(C,", but performance is much better due to the iterative execution of the "),Tt=a(C,"CODE",{});var bn=n(Tt);ta=i(bn,"unet"),bn.forEach(t),sa=i(C,"."),C.forEach(t),ps.forEach(t),la=p(w),L=a(w,"DIV",{class:!0});var ds=n(L);J(Ne.$$.fragment,ds),aa=p(ds),k=a(ds,"P",{});var Ae=n(k);na=i(Ae,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),Et=a(Ae,"CODE",{});var yn=n(Et);oa=i(yn,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),yn.forEach(t),ia=i(Ae,"forward"),jt=a(Ae,"CODE",{});var wn=n(jt);ra=i(wn,"method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),wn.forEach(t),ca=i(Ae,"enable_model_cpu_offload`, but performance is lower."),Ae.forEach(t),ds.forEach(t),w.forEach(t),this.h()},h(){r(_,"name","hf:doc:metadata"),r(_,"content",JSON.stringify(Zn)),r(b,"id","consistency-models"),r(b,"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"),r(b,"href","#consistency-models"),r(y,"class","relative group"),r(K,"href","https://arxiv.org/abs/2303.01469"),r(K,"rel","nofollow"),r(ee,"href","https://arxiv.org/pdf/2303.01469.pdf"),r(ee,"rel","nofollow"),r(te,"href","https://arxiv.org/abs/2303.01469"),r(te,"rel","nofollow"),r(se,"href","https://github.com/openai/consistency_models"),r(se,"rel","nofollow"),r(ae,"href","https://huggingface.co/openai/diffusers-cd_imagenet64_l2"),r(ae,"rel","nofollow"),r(oe,"href","https://huggingface.co/openai/diffusers-cd_imagenet64_lpips"),r(oe,"rel","nofollow"),r(re,"href","https://huggingface.co/openai/diffusers-ct_imagenet64"),r(re,"rel","nofollow"),r(pe,"href","https://huggingface.co/openai/diffusers-cd_bedroom256_l2"),r(pe,"rel","nofollow"),r(me,"href","https://huggingface.co/openai/diffusers-cd_bedroom256_lpips"),r(me,"rel","nofollow"),r(fe,"href","https://huggingface.co/openai/diffusers-ct_bedroom256"),r(fe,"rel","nofollow"),r(ge,"href","https://huggingface.co/openai/diffusers-cd_cat256_l2"),r(ge,"rel","nofollow"),r(be,"href","https://huggingface.co/openai/diffusers-cd_cat256_lpips"),r(be,"rel","nofollow"),r(we,"href","https://huggingface.co/openai/diffusers-ct_cat256"),r(we,"rel","nofollow"),r(P,"id","available-pipelines"),r(P,"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"),r(P,"href","#available-pipelines"),r(N,"class","relative group"),r(Ve,"align","center"),r(Xe,"align","center"),r(ze,"align","center"),r(Pe,"align","center"),r(Me,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_consistency_models.py"),r(Me,"rel","nofollow"),r(Re,"align","center"),r(Fe,"align","center"),r(ht,"align","center"),r(ft,"align","center"),r(Je,"href","https://github.com/dg845"),r(Je,"rel","nofollow"),r(Te,"href","https://huggingface.co/ayushtues"),r(Te,"rel","nofollow"),r(F,"id","usage-example"),r(F,"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"),r(F,"href","#usage-example"),r(x,"class","relative group"),r(D,"id","diffusers.ConsistencyModelPipeline"),r(D,"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"),r(D,"href","#diffusers.ConsistencyModelPipeline"),r(Y,"class","relative group"),r(Se,"href","/docs/diffusers/v0.18.2/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),r(We,"href","https://arxiv.org/pdf/2303.01469"),r(We,"rel","nofollow"),r(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),r(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),r(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),r(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(s,d){e(document.head,_),m(s,$,d),m(s,y,d),e(y,b),e(b,Z),T(h,Z,null),e(y,W),e(y,He),e(He,fs),m(s,Ut,d),m(s,V,d),e(V,us),e(V,K),e(K,gs),e(V,_s),m(s,Gt,d),m(s,X,d),e(X,bs),e(X,ee),e(ee,ys),e(X,ws),m(s,Zt,d),m(s,Ye,d),e(Ye,Le),e(Le,vs),m(s,Wt,d),m(s,ke,d),e(ke,Ms),m(s,Bt,d),m(s,z,d),e(z,qe),e(qe,te),e(te,Js),e(z,Ts),e(z,Oe),e(Oe,se),e(se,Es),m(s,Ct,d),m(s,$e,d),e($e,js),m(s,Nt,d),m(s,f,d),e(f,le),e(le,Ke),e(Ke,Is),e(le,Us),e(le,ae),e(ae,Gs),e(f,Zs),e(f,ne),e(ne,et),e(et,Ws),e(ne,Bs),e(ne,oe),e(oe,Cs),e(f,Ns),e(f,ie),e(ie,tt),e(tt,xs),e(ie,Ys),e(ie,re),e(re,ks),e(f,$s),e(f,ce),e(ce,st),e(st,Vs),e(ce,Xs),e(ce,pe),e(pe,zs),e(f,Ps),e(f,de),e(de,lt),e(lt,Rs),e(de,Fs),e(de,me),e(me,Ss),e(f,Ds),e(f,he),e(he,at),e(at,Qs),e(he,As),e(he,fe),e(fe,Hs),e(f,Ls),e(f,ue),e(ue,nt),e(nt,qs),e(ue,Os),e(ue,ge),e(ge,Ks),e(f,el),e(f,_e),e(_e,ot),e(ot,tl),e(_e,sl),e(_e,be),e(be,ll),e(f,al),e(f,ye),e(ye,it),e(it,nl),e(ye,ol),e(ye,we),e(we,il),m(s,xt,d),m(s,N,d),e(N,P),e(P,rt),T(ve,rt,null),e(N,rl),e(N,ct),e(ct,cl),m(s,Yt,d),m(s,R,d),e(R,pt),e(pt,U),e(U,Ve),e(Ve,pl),e(U,dl),e(U,Xe),e(Xe,ml),e(U,hl),e(U,ze),e(ze,fl),e(U,ul),e(U,Pe),e(Pe,gl),e(R,_l),e(R,dt),e(dt,G),e(G,Re),e(Re,Me),e(Me,bl),e(G,yl),e(G,Fe),e(Fe,mt),e(mt,wl),e(G,vl),e(G,ht),e(G,Ml),e(G,ft),m(s,kt,d),m(s,B,d),e(B,Jl),e(B,Je),e(Je,Tl),e(B,El),e(B,Te),e(Te,jl),e(B,Il),m(s,$t,d),m(s,x,d),e(x,F),e(F,ut),T(Ee,ut,null),e(x,Ul),e(x,gt),e(gt,Gl),m(s,Vt,d),T(je,s,d),m(s,Xt,d),m(s,S,d),e(S,Zl),e(S,_t),e(_t,Wl),e(S,Bl),m(s,zt,d),T(Ie,s,d),m(s,Pt,d),m(s,Y,d),e(Y,D),e(D,bt),T(Ue,bt,null),e(Y,Cl),e(Y,yt),e(yt,Nl),m(s,Rt,d),m(s,u,d),T(Ge,u,null),e(u,xl),e(u,wt),e(wt,Yl),e(u,kl),e(u,Ze),e(Ze,$l),e(Ze,Se),e(Se,Vl),e(Ze,Xl),e(u,zl),e(u,De),e(De,Pl),e(De,We),e(We,Rl),e(u,Fl),e(u,Q),T(Be,Q,null),e(Q,Sl),T(A,Q,null),e(u,Dl),e(u,H),T(Ce,H,null),e(H,Ql),e(H,v),e(v,Al),e(v,vt),e(vt,Hl),e(v,Ll),e(v,Mt),e(Mt,ql),e(v,Ol),e(v,Jt),e(Jt,Kl),e(v,ea),e(v,Tt),e(Tt,ta),e(v,sa),e(u,la),e(u,L),T(Ne,L,null),e(L,aa),e(L,k),e(k,na),e(k,Et),e(Et,oa),e(k,ia),e(k,jt),e(jt,ra),e(k,ca),Ft=!0},p(s,[d]){const xe={};d&2&&(xe.$$scope={dirty:d,ctx:s}),A.$set(xe)},i(s){Ft||(E(h.$$.fragment,s),E(ve.$$.fragment,s),E(Ee.$$.fragment,s),E(je.$$.fragment,s),E(Ie.$$.fragment,s),E(Ue.$$.fragment,s),E(Ge.$$.fragment,s),E(Be.$$.fragment,s),E(A.$$.fragment,s),E(Ce.$$.fragment,s),E(Ne.$$.fragment,s),Ft=!0)},o(s){j(h.$$.fragment,s),j(ve.$$.fragment,s),j(Ee.$$.fragment,s),j(je.$$.fragment,s),j(Ie.$$.fragment,s),j(Ue.$$.fragment,s),j(Ge.$$.fragment,s),j(Be.$$.fragment,s),j(A.$$.fragment,s),j(Ce.$$.fragment,s),j(Ne.$$.fragment,s),Ft=!1},d(s){t(_),s&&t($),s&&t(y),I(h),s&&t(Ut),s&&t(V),s&&t(Gt),s&&t(X),s&&t(Zt),s&&t(Ye),s&&t(Wt),s&&t(ke),s&&t(Bt),s&&t(z),s&&t(Ct),s&&t($e),s&&t(Nt),s&&t(f),s&&t(xt),s&&t(N),I(ve),s&&t(Yt),s&&t(R),s&&t(kt),s&&t(B),s&&t($t),s&&t(x),I(Ee),s&&t(Vt),I(je,s),s&&t(Xt),s&&t(S),s&&t(zt),I(Ie,s),s&&t(Pt),s&&t(Y),I(Ue),s&&t(Rt),s&&t(u),I(Ge),I(Be),I(A),I(Ce),I(Ne)}}}const Zn={local:"consistency-models",sections:[{local:"available-pipelines",title:"Available Pipelines"},{local:"usage-example",title:"Usage Example"},{local:"diffusers.ConsistencyModelPipeline",title:"ConsistencyModelPipeline"}],title:"Consistency Models"};function Wn(It){return En(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class kn extends vn{constructor(_){super();Mn(this,_,Wn,Gn,Jn,{})}}export{kn as default,Zn as metadata};
