import{s as ot,n as at,o as st}from"../chunks/scheduler.53228c21.js";import{S as it,i as lt,e as i,s as r,c as m,h as dt,a as l,d as n,b as o,f as b,g as c,j as _,k as $,l as t,m as u,n as p,t as f,o as g,p as h}from"../chunks/index.100fac89.js";import{C as ut}from"../chunks/CopyLLMTxtMenu.494046bd.js";import{D as v}from"../chunks/Docstring.9bbf7d33.js";import{C as mt}from"../chunks/CodeBlock.d30a6509.js";import{H as Je,E as ct}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.8999c127.js";function pt(Ge){let y,se,oe,ie,D,le,A,de,M,Ne="The 2D variational autoencoder (VAE) model with KL loss used in [HunyuanImage2.1].",ue,E,Ue="The model can be loaded with the following code snippet.",me,k,ce,K,pe,a,V,He,q,qe="A VAE model for 2D images with spatial tiling support.",Te,B,Be=`This model inherits from <a href="/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin">ModelMixin</a>. Check the superclass documentation for it’s generic methods implemented
for all models (such as downloading or saving).`,Ce,F,W,De,L,j,Ae,R,Fe=`Disable sliced VAE decoding. If <code>enable_slicing</code> was previously enabled, this method will go back to computing
decoding in one step.`,Me,w,z,Ee,X,Re=`Disable tiled VAE decoding. If <code>enable_tiling</code> was previously enabled, this method will go back to computing
decoding in one step.`,ke,I,O,Ke,Y,Xe=`Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to
compute decoding in several steps. This is useful to save some memory and allow larger batch sizes.`,Ve,H,P,We,Q,Ye=`Enable spatial tiled VAE decoding. When this option is enabled, the VAE will split the input tensor into tiles
to compute decoding and encoding in several steps. This is useful for saving a large amount of memory and to
allow processing larger images.`,je,ee,Z,ze,T,S,Oe,te,Qe="Decode latent using spatial tiling strategy.",Pe,C,J,Ze,ne,et="Encode input using spatial tiling strategy.",fe,G,ge,x,N,Se,re,tt="Output of decoding method.",he,U,be,ae,$e;return D=new ut({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),A=new Je({props:{title:"AutoencoderKLHunyuanImage",local:"autoencoderklhunyuanimage",headingTag:"h1"}}),k=new mt({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xIdW55dWFuSW1hZ2UlMEElMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMSHVueXVhbkltYWdlLmZyb21fcHJldHJhaW5lZCglMjJodW55dWFudmlkZW8tY29tbXVuaXR5JTJGSHVueXVhbkltYWdlLTIuMS1EaWZmdXNlcnMlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ2YWUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLHunyuanImage

vae = AutoencoderKLHunyuanImage.from_pretrained(<span class="hljs-string">&quot;hunyuanvideo-community/HunyuanImage-2.1-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.bfloat16)`,wrap:!1}}),K=new Je({props:{title:"AutoencoderKLHunyuanImage",local:"diffusers.AutoencoderKLHunyuanImage",headingTag:"h2"}}),V=new v({props:{name:"class diffusers.AutoencoderKLHunyuanImage",anchor:"diffusers.AutoencoderKLHunyuanImage",parameters:[{name:"in_channels",val:": int"},{name:"out_channels",val:": int"},{name:"latent_channels",val:": int"},{name:"block_out_channels",val:": typing.Tuple[int, ...]"},{name:"layers_per_block",val:": int"},{name:"spatial_compression_ratio",val:": int"},{name:"sample_size",val:": int"},{name:"scaling_factor",val:": float = None"},{name:"downsample_match_channel",val:": bool = True"},{name:"upsample_match_channel",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L413"}}),W=new v({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLHunyuanImage.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/accelerate_utils.py#L43"}}),j=new v({props:{name:"disable_slicing",anchor:"diffusers.AutoencoderKLHunyuanImage.disable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L503"}}),z=new v({props:{name:"disable_tiling",anchor:"diffusers.AutoencoderKLHunyuanImage.disable_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L489"}}),O=new v({props:{name:"enable_slicing",anchor:"diffusers.AutoencoderKLHunyuanImage.enable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L496"}}),P=new v({props:{name:"enable_tiling",anchor:"diffusers.AutoencoderKLHunyuanImage.enable_tiling",parameters:[{name:"tile_sample_min_size",val:": typing.Optional[int] = None"},{name:"tile_overlap_factor",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanImage.enable_tiling.tile_sample_min_size",description:`<strong>tile_sample_min_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The minimum size required for a sample to be separated into tiles across the spatial dimension.`,name:"tile_sample_min_size"},{anchor:"diffusers.AutoencoderKLHunyuanImage.enable_tiling.tile_overlap_factor",description:`<strong>tile_overlap_factor</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The overlap factor required for a latent to be separated into tiles across the spatial dimension.`,name:"tile_overlap_factor"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L468"}}),Z=new v({props:{name:"forward",anchor:"diffusers.AutoencoderKLHunyuanImage.forward",parameters:[{name:"sample",val:": Tensor"},{name:"sample_posterior",val:": bool = False"},{name:"return_dict",val:": bool = True"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanImage.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014; Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLHunyuanImage.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L689"}}),S=new v({props:{name:"tiled_decode",anchor:"diffusers.AutoencoderKLHunyuanImage.tiled_decode",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanImage.tiled_decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) &#x2014; Latent tensor of shape (B, C, H, W).",name:"z"},{anchor:"diffusers.AutoencoderKLHunyuanImage.tiled_decode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~models.vae.DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L644",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If return_dict is True, a <code>~models.vae.DecoderOutput</code> is returned, otherwise a plain <code>tuple</code> is
returned.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~models.vae.DecoderOutput</code> or <code>tuple</code></p>
`}}),J=new v({props:{name:"tiled_encode",anchor:"diffusers.AutoencoderKLHunyuanImage.tiled_encode",parameters:[{name:"x",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanImage.tiled_encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) &#x2014; Input tensor of shape (B, C, T, H, W).",name:"x"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L604",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The latent representation of the encoded images.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),G=new Je({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),N=new v({props:{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",parameters:[{name:"sample",val:": Tensor"},{name:"commit_loss",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"diffusers.models.autoencoders.vae.DecoderOutput.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
The decoded output sample from the last layer of the model.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/vae.py#L47"}}),U=new ct({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoder_kl_hunyuanimage.md"}}),{c(){y=i("meta"),se=r(),oe=i("p"),ie=r(),m(D.$$.fragment),le=r(),m(A.$$.fragment),de=r(),M=i("p"),M.textContent=Ne,ue=r(),E=i("p"),E.textContent=Ue,me=r(),m(k.$$.fragment),ce=r(),m(K.$$.fragment),pe=r(),a=i("div"),m(V.$$.fragment),He=r(),q=i("p"),q.textContent=qe,Te=r(),B=i("p"),B.innerHTML=Be,Ce=r(),F=i("div"),m(W.$$.fragment),De=r(),L=i("div"),m(j.$$.fragment),Ae=r(),R=i("p"),R.innerHTML=Fe,Me=r(),w=i("div"),m(z.$$.fragment),Ee=r(),X=i("p"),X.innerHTML=Re,ke=r(),I=i("div"),m(O.$$.fragment),Ke=r(),Y=i("p"),Y.textContent=Xe,Ve=r(),H=i("div"),m(P.$$.fragment),We=r(),Q=i("p"),Q.textContent=Ye,je=r(),ee=i("div"),m(Z.$$.fragment),ze=r(),T=i("div"),m(S.$$.fragment),Oe=r(),te=i("p"),te.textContent=Qe,Pe=r(),C=i("div"),m(J.$$.fragment),Ze=r(),ne=i("p"),ne.textContent=et,fe=r(),m(G.$$.fragment),ge=r(),x=i("div"),m(N.$$.fragment),Se=r(),re=i("p"),re.textContent=tt,he=r(),m(U.$$.fragment),be=r(),ae=i("p"),this.h()},l(e){const s=dt("svelte-u9bgzb",document.head);y=l(s,"META",{name:!0,content:!0}),s.forEach(n),se=o(e),oe=l(e,"P",{}),b(oe).forEach(n),ie=o(e),c(D.$$.fragment,e),le=o(e),c(A.$$.fragment,e),de=o(e),M=l(e,"P",{"data-svelte-h":!0}),_(M)!=="svelte-j3jzb0"&&(M.textContent=Ne),ue=o(e),E=l(e,"P",{"data-svelte-h":!0}),_(E)!=="svelte-1vuni30"&&(E.textContent=Ue),me=o(e),c(k.$$.fragment,e),ce=o(e),c(K.$$.fragment,e),pe=o(e),a=l(e,"DIV",{class:!0});var d=b(a);c(V.$$.fragment,d),He=o(d),q=l(d,"P",{"data-svelte-h":!0}),_(q)!=="svelte-ihc0rv"&&(q.textContent=qe),Te=o(d),B=l(d,"P",{"data-svelte-h":!0}),_(B)!=="svelte-1hyu2ru"&&(B.innerHTML=Be),Ce=o(d),F=l(d,"DIV",{class:!0});var nt=b(F);c(W.$$.fragment,nt),nt.forEach(n),De=o(d),L=l(d,"DIV",{class:!0});var _e=b(L);c(j.$$.fragment,_e),Ae=o(_e),R=l(_e,"P",{"data-svelte-h":!0}),_(R)!=="svelte-189cc7b"&&(R.innerHTML=Fe),_e.forEach(n),Me=o(d),w=l(d,"DIV",{class:!0});var ve=b(w);c(z.$$.fragment,ve),Ee=o(ve),X=l(ve,"P",{"data-svelte-h":!0}),_(X)!=="svelte-1f366pl"&&(X.innerHTML=Re),ve.forEach(n),ke=o(d),I=l(d,"DIV",{class:!0});var ye=b(I);c(O.$$.fragment,ye),Ke=o(ye),Y=l(ye,"P",{"data-svelte-h":!0}),_(Y)!=="svelte-14bnrb6"&&(Y.textContent=Xe),ye.forEach(n),Ve=o(d),H=l(d,"DIV",{class:!0});var xe=b(H);c(P.$$.fragment,xe),We=o(xe),Q=l(xe,"P",{"data-svelte-h":!0}),_(Q)!=="svelte-1u7boat"&&(Q.textContent=Ye),xe.forEach(n),je=o(d),ee=l(d,"DIV",{class:!0});var rt=b(ee);c(Z.$$.fragment,rt),rt.forEach(n),ze=o(d),T=l(d,"DIV",{class:!0});var Le=b(T);c(S.$$.fragment,Le),Oe=o(Le),te=l(Le,"P",{"data-svelte-h":!0}),_(te)!=="svelte-1ahxoui"&&(te.textContent=Qe),Le.forEach(n),Pe=o(d),C=l(d,"DIV",{class:!0});var we=b(C);c(J.$$.fragment,we),Ze=o(we),ne=l(we,"P",{"data-svelte-h":!0}),_(ne)!=="svelte-1kunvls"&&(ne.textContent=et),we.forEach(n),d.forEach(n),fe=o(e),c(G.$$.fragment,e),ge=o(e),x=l(e,"DIV",{class:!0});var Ie=b(x);c(N.$$.fragment,Ie),Se=o(Ie),re=l(Ie,"P",{"data-svelte-h":!0}),_(re)!=="svelte-18u8upa"&&(re.textContent=tt),Ie.forEach(n),he=o(e),c(U.$$.fragment,e),be=o(e),ae=l(e,"P",{}),b(ae).forEach(n),this.h()},h(){$(y,"name","hf:doc:metadata"),$(y,"content",ft),$(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(a,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(x,"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){t(document.head,y),u(e,se,s),u(e,oe,s),u(e,ie,s),p(D,e,s),u(e,le,s),p(A,e,s),u(e,de,s),u(e,M,s),u(e,ue,s),u(e,E,s),u(e,me,s),p(k,e,s),u(e,ce,s),p(K,e,s),u(e,pe,s),u(e,a,s),p(V,a,null),t(a,He),t(a,q),t(a,Te),t(a,B),t(a,Ce),t(a,F),p(W,F,null),t(a,De),t(a,L),p(j,L,null),t(L,Ae),t(L,R),t(a,Me),t(a,w),p(z,w,null),t(w,Ee),t(w,X),t(a,ke),t(a,I),p(O,I,null),t(I,Ke),t(I,Y),t(a,Ve),t(a,H),p(P,H,null),t(H,We),t(H,Q),t(a,je),t(a,ee),p(Z,ee,null),t(a,ze),t(a,T),p(S,T,null),t(T,Oe),t(T,te),t(a,Pe),t(a,C),p(J,C,null),t(C,Ze),t(C,ne),u(e,fe,s),p(G,e,s),u(e,ge,s),u(e,x,s),p(N,x,null),t(x,Se),t(x,re),u(e,he,s),p(U,e,s),u(e,be,s),u(e,ae,s),$e=!0},p:at,i(e){$e||(f(D.$$.fragment,e),f(A.$$.fragment,e),f(k.$$.fragment,e),f(K.$$.fragment,e),f(V.$$.fragment,e),f(W.$$.fragment,e),f(j.$$.fragment,e),f(z.$$.fragment,e),f(O.$$.fragment,e),f(P.$$.fragment,e),f(Z.$$.fragment,e),f(S.$$.fragment,e),f(J.$$.fragment,e),f(G.$$.fragment,e),f(N.$$.fragment,e),f(U.$$.fragment,e),$e=!0)},o(e){g(D.$$.fragment,e),g(A.$$.fragment,e),g(k.$$.fragment,e),g(K.$$.fragment,e),g(V.$$.fragment,e),g(W.$$.fragment,e),g(j.$$.fragment,e),g(z.$$.fragment,e),g(O.$$.fragment,e),g(P.$$.fragment,e),g(Z.$$.fragment,e),g(S.$$.fragment,e),g(J.$$.fragment,e),g(G.$$.fragment,e),g(N.$$.fragment,e),g(U.$$.fragment,e),$e=!1},d(e){e&&(n(se),n(oe),n(ie),n(le),n(de),n(M),n(ue),n(E),n(me),n(ce),n(pe),n(a),n(fe),n(ge),n(x),n(he),n(be),n(ae)),n(y),h(D,e),h(A,e),h(k,e),h(K,e),h(V),h(W),h(j),h(z),h(O),h(P),h(Z),h(S),h(J),h(G,e),h(N),h(U,e)}}}const ft='{"title":"AutoencoderKLHunyuanImage","local":"autoencoderklhunyuanimage","sections":[{"title":"AutoencoderKLHunyuanImage","local":"diffusers.AutoencoderKLHunyuanImage","sections":[],"depth":2},{"title":"DecoderOutput","local":"diffusers.models.autoencoders.vae.DecoderOutput","sections":[],"depth":2}],"depth":1}';function gt(Ge){return st(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xt extends it{constructor(y){super(),lt(this,y,gt,pt,ot,{})}}export{xt as component};
