Buckets:
| import{s as Me,o as ke,n as Te}from"../chunks/scheduler.53228c21.js";import{S as je,i as Ve,e as p,s,c as g,h as Ue,a as m,d as t,b as o,f as I,g as _,j as x,k,l as c,m as r,n as b,t as v,o as $,p as y}from"../chunks/index.cac5d66a.js";import{C as Ae}from"../chunks/CopyLLMTxtMenu.5ac9ab94.js";import{D as S}from"../chunks/Docstring.8a316450.js";import{C as Ze}from"../chunks/CodeBlock.606cbaf4.js";import{E as Le}from"../chunks/ExampleCodeBlock.81a3017d.js";import{H as Ee,E as Be}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.92b2cd9d.js";function We(X){let i,T="Examples:",D,u,f;return u=new Ze({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUlMkMlMjBDb25zaXN0ZW5jeURlY29kZXJWQUUlMEElMEF2YWUlMjAlM0QlMjBDb25zaXN0ZW5jeURlY29kZXJWQUUuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmNvbnNpc3RlbmN5LWRlY29kZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFibGUtZGlmZnVzaW9uLXYxLTUlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjB2YWUlM0R2YWUlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpLnRvKCUyMmN1ZGElMjIpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUyMmhvcnNlJTIyJTJDJTIwZ2VuZXJhdG9yJTNEdG9yY2gubWFudWFsX3NlZWQoMCkpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline, ConsistencyDecoderVAE | |
| <span class="hljs-meta">>>> </span>vae = ConsistencyDecoderVAE.from_pretrained(<span class="hljs-string">"openai/consistency-decoder"</span>, torch_dtype=torch.float16) | |
| <span class="hljs-meta">>>> </span>pipe = StableDiffusionPipeline.from_pretrained( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"stable-diffusion-v1-5/stable-diffusion-v1-5"</span>, vae=vae, torch_dtype=torch.float16 | |
| <span class="hljs-meta">... </span>).to(<span class="hljs-string">"cuda"</span>) | |
| <span class="hljs-meta">>>> </span>image = pipe(<span class="hljs-string">"horse"</span>, generator=torch.manual_seed(<span class="hljs-number">0</span>)).images[<span class="hljs-number">0</span>] | |
| <span class="hljs-meta">>>> </span>image`,lang:"py",wrap:!1}}),{c(){i=p("p"),i.textContent=T,D=s(),g(u.$$.fragment)},l(a){i=m(a,"P",{"data-svelte-h":!0}),x(i)!=="svelte-kvfsh7"&&(i.textContent=T),D=o(a),_(u.$$.fragment,a)},m(a,h){r(a,i,h),r(a,D,h),b(u,a,h),f=!0},p:Te,i(a){f||(v(u.$$.fragment,a),f=!0)},o(a){$(u.$$.fragment,a),f=!1},d(a){a&&(t(i),t(D)),y(u,a)}}}function Je(X){let i,T,D,u,f,a,h,O,j,ge='Consistency decoder can be used to decode the latents from the denoising UNet in the <a href="/docs/diffusers/pr_13813/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline">StableDiffusionPipeline</a>. This decoder was introduced in the <a href="https://openai.com/dall-e-3" rel="nofollow">DALL-E 3 technical report</a>.',Q,V,_e='The original codebase can be found at <a href="https://github.com/openai/consistencydecoder" rel="nofollow">openai/consistencydecoder</a>.',K,C,be="<p>Inference is only supported for 2 iterations as of now.</p>",ee,U,ve='The pipeline could not have been contributed without the help of <a href="https://github.com/madebyollin" rel="nofollow">madebyollin</a> and <a href="https://github.com/mrsteyk" rel="nofollow">mrsteyk</a> from <a href="https://github.com/openai/consistencydecoder/issues/1" rel="nofollow">this issue</a>.',te,A,ne,l,Z,le,z,$e="The consistency decoder used with DALL-E 3.",ce,E,ie,G,L,de,P,B,pe,M,W,me,F,ye="Disables custom attention processors and sets the default attention implementation.",ue,w,J,fe,N,De="Encode a batch of images using a tiled encoder.",he,H,we=`When this option is enabled, the VAE will split the input tensor into tiles to compute encoding in several | |
| steps. This is useful to keep memory use constant regardless of image size. The end result of tiled encoding is | |
| different from non-tiled encoding because each tile uses a different encoder. To avoid tiling artifacts, the | |
| tiles overlap and are blended together to form a smooth output. You may still see tile-sized changes in the | |
| output, but they should be much less noticeable.`,se,R,oe,q,re;return f=new Ae({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),h=new Ee({props:{title:"Consistency Decoder",local:"consistency-decoder",headingTag:"h1"}}),A=new Ee({props:{title:"ConsistencyDecoderVAE",local:"diffusers.ConsistencyDecoderVAE",headingTag:"h2"}}),Z=new S({props:{name:"class diffusers.ConsistencyDecoderVAE",anchor:"diffusers.ConsistencyDecoderVAE",parameters:[{name:"scaling_factor",val:": float = 0.18215"},{name:"latent_channels",val:": int = 4"},{name:"sample_size",val:": int = 32"},{name:"encoder_act_fn",val:": str = 'silu'"},{name:"encoder_block_out_channels",val:": tuple = (128, 256, 512, 512)"},{name:"encoder_double_z",val:": bool = True"},{name:"encoder_down_block_types",val:": tuple = ('DownEncoderBlock2D', 'DownEncoderBlock2D', 'DownEncoderBlock2D', 'DownEncoderBlock2D')"},{name:"encoder_in_channels",val:": int = 3"},{name:"encoder_layers_per_block",val:": int = 2"},{name:"encoder_norm_num_groups",val:": int = 32"},{name:"encoder_out_channels",val:": int = 4"},{name:"decoder_add_attention",val:": bool = False"},{name:"decoder_block_out_channels",val:": tuple = (320, 640, 1024, 1024)"},{name:"decoder_down_block_types",val:": tuple = ('ResnetDownsampleBlock2D', 'ResnetDownsampleBlock2D', 'ResnetDownsampleBlock2D', 'ResnetDownsampleBlock2D')"},{name:"decoder_downsample_padding",val:": int = 1"},{name:"decoder_in_channels",val:": int = 7"},{name:"decoder_layers_per_block",val:": int = 3"},{name:"decoder_norm_eps",val:": float = 1e-05"},{name:"decoder_norm_num_groups",val:": int = 32"},{name:"decoder_num_train_timesteps",val:": int = 1024"},{name:"decoder_out_channels",val:": int = 6"},{name:"decoder_resnet_time_scale_shift",val:": str = 'scale_shift'"},{name:"decoder_time_embedding_type",val:": str = 'learned'"},{name:"decoder_up_block_types",val:": tuple = ('ResnetUpsampleBlock2D', 'ResnetUpsampleBlock2D', 'ResnetUpsampleBlock2D', 'ResnetUpsampleBlock2D')"}],source:"https://github.com/huggingface/diffusers/blob/vr_13813/src/diffusers/models/autoencoders/consistency_decoder_vae.py#L51"}}),E=new Le({props:{anchor:"diffusers.ConsistencyDecoderVAE.example",$$slots:{default:[We]},$$scope:{ctx:X}}}),L=new S({props:{name:"wrapper",anchor:"diffusers.ConsistencyDecoderVAE.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_13813/src/diffusers/utils/accelerate_utils.py#L43"}}),B=new S({props:{name:"forward",anchor:"diffusers.ConsistencyDecoderVAE.forward",parameters:[{name:"sample",val:": Tensor"},{name:"sample_posterior",val:": bool = False"},{name:"return_dict",val:": bool = True"},{name:"generator",val:": torch._C.Generator | None = None"}],parametersDescription:[{anchor:"diffusers.ConsistencyDecoderVAE.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) — Input sample.",name:"sample"},{anchor:"diffusers.ConsistencyDecoderVAE.forward.sample_posterior",description:`<strong>sample_posterior</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to sample from the posterior.`,name:"sample_posterior"},{anchor:"diffusers.ConsistencyDecoderVAE.forward.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>DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.ConsistencyDecoderVAE.forward.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>, defaults to <code>None</code>) — | |
| Generator to use for sampling.`,name:"generator"}],source:"https://github.com/huggingface/diffusers/blob/vr_13813/src/diffusers/models/autoencoders/consistency_decoder_vae.py#L336",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If return_dict is True, a <code>DecoderOutput</code> is returned, otherwise a plain <code>tuple</code> is returned.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>DecoderOutput</code> or <code>tuple</code></p> | |
| `}}),W=new S({props:{name:"set_default_attn_processor",anchor:"diffusers.ConsistencyDecoderVAE.set_default_attn_processor",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_13813/src/diffusers/models/autoencoders/consistency_decoder_vae.py#L170"}}),J=new S({props:{name:"tiled_encode",anchor:"diffusers.ConsistencyDecoderVAE.tiled_encode",parameters:[{name:"x",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.ConsistencyDecoderVAE.tiled_encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) — Input batch of images.",name:"x"},{anchor:"diffusers.ConsistencyDecoderVAE.tiled_encode.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>ConsistencyDecoderVAEOutput</code> | |
| instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13813/src/diffusers/models/autoencoders/consistency_decoder_vae.py#L281",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If return_dict is True, a <code>ConsistencyDecoderVAEOutput</code> | |
| is returned, otherwise a plain <code>tuple</code> is returned.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>ConsistencyDecoderVAEOutput</code> or <code>tuple</code></p> | |
| `}}),R=new Be({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/consistency_decoder_vae.md"}}),{c(){i=p("meta"),T=s(),D=p("p"),u=s(),g(f.$$.fragment),a=s(),g(h.$$.fragment),O=s(),j=p("p"),j.innerHTML=ge,Q=s(),V=p("p"),V.innerHTML=_e,K=s(),C=p("blockquote"),C.innerHTML=be,ee=s(),U=p("p"),U.innerHTML=ve,te=s(),g(A.$$.fragment),ne=s(),l=p("div"),g(Z.$$.fragment),le=s(),z=p("p"),z.textContent=$e,ce=s(),g(E.$$.fragment),ie=s(),G=p("div"),g(L.$$.fragment),de=s(),P=p("div"),g(B.$$.fragment),pe=s(),M=p("div"),g(W.$$.fragment),me=s(),F=p("p"),F.textContent=ye,ue=s(),w=p("div"),g(J.$$.fragment),fe=s(),N=p("p"),N.textContent=De,he=s(),H=p("p"),H.textContent=we,se=s(),g(R.$$.fragment),oe=s(),q=p("p"),this.h()},l(e){const n=Ue("svelte-u9bgzb",document.head);i=m(n,"META",{name:!0,content:!0}),n.forEach(t),T=o(e),D=m(e,"P",{}),I(D).forEach(t),u=o(e),_(f.$$.fragment,e),a=o(e),_(h.$$.fragment,e),O=o(e),j=m(e,"P",{"data-svelte-h":!0}),x(j)!=="svelte-157ee33"&&(j.innerHTML=ge),Q=o(e),V=m(e,"P",{"data-svelte-h":!0}),x(V)!=="svelte-uyyo7l"&&(V.innerHTML=_e),K=o(e),C=m(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),x(C)!=="svelte-1mg82lp"&&(C.innerHTML=be),ee=o(e),U=m(e,"P",{"data-svelte-h":!0}),x(U)!=="svelte-1ln42ze"&&(U.innerHTML=ve),te=o(e),_(A.$$.fragment,e),ne=o(e),l=m(e,"DIV",{class:!0});var d=I(l);_(Z.$$.fragment,d),le=o(d),z=m(d,"P",{"data-svelte-h":!0}),x(z)!=="svelte-1fvfwaa"&&(z.textContent=$e),ce=o(d),_(E.$$.fragment,d),ie=o(d),G=m(d,"DIV",{class:!0});var xe=I(G);_(L.$$.fragment,xe),xe.forEach(t),de=o(d),P=m(d,"DIV",{class:!0});var Ce=I(P);_(B.$$.fragment,Ce),Ce.forEach(t),pe=o(d),M=m(d,"DIV",{class:!0});var ae=I(M);_(W.$$.fragment,ae),me=o(ae),F=m(ae,"P",{"data-svelte-h":!0}),x(F)!=="svelte-1lxcwhv"&&(F.textContent=ye),ae.forEach(t),ue=o(d),w=m(d,"DIV",{class:!0});var Y=I(w);_(J.$$.fragment,Y),fe=o(Y),N=m(Y,"P",{"data-svelte-h":!0}),x(N)!=="svelte-1un5fcn"&&(N.textContent=De),he=o(Y),H=m(Y,"P",{"data-svelte-h":!0}),x(H)!=="svelte-lbfkqr"&&(H.textContent=we),Y.forEach(t),d.forEach(t),se=o(e),_(R.$$.fragment,e),oe=o(e),q=m(e,"P",{}),I(q).forEach(t),this.h()},h(){k(i,"name","hf:doc:metadata"),k(i,"content",Re),k(C,"class","warning"),k(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(l,"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,n){c(document.head,i),r(e,T,n),r(e,D,n),r(e,u,n),b(f,e,n),r(e,a,n),b(h,e,n),r(e,O,n),r(e,j,n),r(e,Q,n),r(e,V,n),r(e,K,n),r(e,C,n),r(e,ee,n),r(e,U,n),r(e,te,n),b(A,e,n),r(e,ne,n),r(e,l,n),b(Z,l,null),c(l,le),c(l,z),c(l,ce),b(E,l,null),c(l,ie),c(l,G),b(L,G,null),c(l,de),c(l,P),b(B,P,null),c(l,pe),c(l,M),b(W,M,null),c(M,me),c(M,F),c(l,ue),c(l,w),b(J,w,null),c(w,fe),c(w,N),c(w,he),c(w,H),r(e,se,n),b(R,e,n),r(e,oe,n),r(e,q,n),re=!0},p(e,[n]){const d={};n&2&&(d.$$scope={dirty:n,ctx:e}),E.$set(d)},i(e){re||(v(f.$$.fragment,e),v(h.$$.fragment,e),v(A.$$.fragment,e),v(Z.$$.fragment,e),v(E.$$.fragment,e),v(L.$$.fragment,e),v(B.$$.fragment,e),v(W.$$.fragment,e),v(J.$$.fragment,e),v(R.$$.fragment,e),re=!0)},o(e){$(f.$$.fragment,e),$(h.$$.fragment,e),$(A.$$.fragment,e),$(Z.$$.fragment,e),$(E.$$.fragment,e),$(L.$$.fragment,e),$(B.$$.fragment,e),$(W.$$.fragment,e),$(J.$$.fragment,e),$(R.$$.fragment,e),re=!1},d(e){e&&(t(T),t(D),t(u),t(a),t(O),t(j),t(Q),t(V),t(K),t(C),t(ee),t(U),t(te),t(ne),t(l),t(se),t(oe),t(q)),t(i),y(f,e),y(h,e),y(A,e),y(Z),y(E),y(L),y(B),y(W),y(J),y(R,e)}}}const Re='{"title":"Consistency Decoder","local":"consistency-decoder","sections":[{"title":"ConsistencyDecoderVAE","local":"diffusers.ConsistencyDecoderVAE","sections":[],"depth":2}],"depth":1}';function Ie(X){return ke(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qe extends je{constructor(i){super(),Ve(this,i,Ie,Je,Me,{})}}export{qe as component}; | |
Xet Storage Details
- Size:
- 14.2 kB
- Xet hash:
- cf1308f831315df8153df40b2cd87b473f0b8944731f2e21bca2d879a6cbed65
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.