import{s as st,n as at,o as dt}from"../chunks/scheduler.8c3d61f6.js";import{S as it,i as lt,g as d,s as n,r as c,A as ut,h as i,f as o,c as r,j as _,u as p,x as v,k as b,y as t,a as u,v as m,d as f,t as g,w as h}from"../chunks/index.da70eac4.js";import{D as y}from"../chunks/Docstring.6b390b9a.js";import{C as ct}from"../chunks/CodeBlock.00a903b3.js";import{H as Se,E as pt}from"../chunks/EditOnGithub.1e64e623.js";function mt(qe){let x,de,se,ie,A,le,k,Ge='The 3D variational autoencoder (VAE) model with KL loss used in <a href="https://github.com/Tencent/HunyuanVideo/" rel="nofollow">HunyuanVideo</a>, which was introduced in <a href="https://huggingface.co/papers/2412.03603" rel="nofollow">HunyuanVideo: A Systematic Framework For Large Video Generative Models</a> by Tencent.',ue,E,Ne="The model can be loaded with the following code snippet.",ce,H,pe,K,me,s,O,Te,N,je=`A VAE model with KL loss for encoding images/videos into latents and decoding latent representations into
images/videos.`,Le,j,Re=`This model inherits from <a href="/docs/diffusers/pr_10136/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).`,Ve,R,P,Ce,D,I,Ae,Y,Ye=`Disable sliced VAE decoding. If <code>enable_slicing</code> was previously enabled, this method will go back to computing
decoding in one step.`,ke,T,M,Ee,J,Je=`Disable tiled VAE decoding. If <code>enable_tiling</code> was previously enabled, this method will go back to computing
decoding in one step.`,He,L,F,Ke,Q,Qe=`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.`,Oe,V,z,Pe,X,Xe=`Enable 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 videos.`,Ie,Z,B,Me,C,W,Fe,ee,Ze="Decode a batch of images/videos using a tiled decoder.",ze,$,U,Be,te,et="Encode a batch of images/videos using a tiled encoder.",We,oe,tt=`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/videos 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.`,fe,S,ge,w,q,Ue,ne,ot="Output of decoding method.",he,G,_e,ae,ve;return A=new Se({props:{title:"AutoencoderKLHunyuanVideo",local:"autoencoderklhunyuanvideo",headingTag:"h1"}}),H=new ct({props:{code:"VE9ETw==",highlighted:"TODO",wrap:!1}}),K=new Se({props:{title:"AutoencoderKLMochi",local:"diffusers.AutoencoderKLHunyuanVideo",headingTag:"h2"}}),O=new y({props:{name:"class diffusers.AutoencoderKLHunyuanVideo",anchor:"diffusers.AutoencoderKLHunyuanVideo",parameters:[{name:"in_channels",val:": int = 3"},{name:"out_channels",val:": int = 3"},{name:"latent_channels",val:": int = 16"},{name:"down_block_types",val:": typing.Tuple[str, ...] = ('DownEncoderBlockCausal3D', 'DownEncoderBlockCausal3D', 'DownEncoderBlockCausal3D', 'DownEncoderBlockCausal3D')"},{name:"up_block_types",val:": typing.Tuple[str, ...] = ('UpDecoderBlockCausal3D', 'UpDecoderBlockCausal3D', 'UpDecoderBlockCausal3D', 'UpDecoderBlockCausal3D')"},{name:"block_out_channels",val:": typing.Tuple[int] = (128, 256, 512, 512)"},{name:"layers_per_block",val:": int = 2"},{name:"act_fn",val:": str = 'silu'"},{name:"norm_num_groups",val:": int = 32"},{name:"sample_size",val:": int = 256"},{name:"sample_tsize",val:": int = 64"},{name:"scaling_factor",val:": float = 0.476986"},{name:"spatial_compression_ratio",val:": int = 8"},{name:"time_compression_ratio",val:": int = 4"},{name:"mid_block_add_attention",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/vr_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L1029"}}),P=new y({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLHunyuanVideo.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10136/src/diffusers/utils/accelerate_utils.py#L43"}}),I=new y({props:{name:"disable_slicing",anchor:"diffusers.AutoencoderKLHunyuanVideo.disable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L1160"}}),M=new y({props:{name:"disable_tiling",anchor:"diffusers.AutoencoderKLHunyuanVideo.disable_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L1145"}}),F=new y({props:{name:"enable_slicing",anchor:"diffusers.AutoencoderKLHunyuanVideo.enable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L1153"}}),z=new y({props:{name:"enable_tiling",anchor:"diffusers.AutoencoderKLHunyuanVideo.enable_tiling",parameters:[{name:"use_tiling",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/vr_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L1136"}}),B=new y({props:{name:"forward",anchor:"diffusers.AutoencoderKLHunyuanVideo.forward",parameters:[{name:"sample",val:": FloatTensor"},{name:"sample_posterior",val:": bool = False"},{name:"return_dict",val:": bool = True"},{name:"return_posterior",val:": bool = False"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanVideo.forward.sample",description:"<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014; Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLHunyuanVideo.forward.sample_posterior",description:`<strong>sample_posterior</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to sample from the posterior.`,name:"sample_posterior"},{anchor:"diffusers.AutoencoderKLHunyuanVideo.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/vr_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L1460"}}),W=new y({props:{name:"spatial_tiled_decode",anchor:"diffusers.AutoencoderKLHunyuanVideo.spatial_tiled_decode",parameters:[{name:"z",val:": FloatTensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanVideo.spatial_tiled_decode.z",description:"<strong>z</strong> (<code>torch.FloatTensor</code>) &#x2014; Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLHunyuanVideo.spatial_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/vr_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L1337",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>
`}}),U=new y({props:{name:"spatial_tiled_encode",anchor:"diffusers.AutoencoderKLHunyuanVideo.spatial_tiled_encode",parameters:[{name:"x",val:": FloatTensor"},{name:"return_dict",val:": bool = True"},{name:"return_moments",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanVideo.spatial_tiled_encode.x",description:"<strong>x</strong> (<code>torch.FloatTensor</code>) &#x2014; Input batch of images/videos.",name:"x"},{anchor:"diffusers.AutoencoderKLHunyuanVideo.spatial_tiled_encode.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.autoencoder_kl.AutoencoderKLOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L1279",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


<p><code>~models.autoencoder_kl.AutoencoderKLOutput</code> or <code>tuple</code></p>
`}}),S=new Se({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),q=new y({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/vr_10136/src/diffusers/models/autoencoders/vae.py#L46"}}),G=new pt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoder_kl_hunyuan_video.md"}}),{c(){x=d("meta"),de=n(),se=d("p"),ie=n(),c(A.$$.fragment),le=n(),k=d("p"),k.innerHTML=Ge,ue=n(),E=d("p"),E.textContent=Ne,ce=n(),c(H.$$.fragment),pe=n(),c(K.$$.fragment),me=n(),s=d("div"),c(O.$$.fragment),Te=n(),N=d("p"),N.textContent=je,Le=n(),j=d("p"),j.innerHTML=Re,Ve=n(),R=d("div"),c(P.$$.fragment),Ce=n(),D=d("div"),c(I.$$.fragment),Ae=n(),Y=d("p"),Y.innerHTML=Ye,ke=n(),T=d("div"),c(M.$$.fragment),Ee=n(),J=d("p"),J.innerHTML=Je,He=n(),L=d("div"),c(F.$$.fragment),Ke=n(),Q=d("p"),Q.textContent=Qe,Oe=n(),V=d("div"),c(z.$$.fragment),Pe=n(),X=d("p"),X.textContent=Xe,Ie=n(),Z=d("div"),c(B.$$.fragment),Me=n(),C=d("div"),c(W.$$.fragment),Fe=n(),ee=d("p"),ee.textContent=Ze,ze=n(),$=d("div"),c(U.$$.fragment),Be=n(),te=d("p"),te.textContent=et,We=n(),oe=d("p"),oe.textContent=tt,fe=n(),c(S.$$.fragment),ge=n(),w=d("div"),c(q.$$.fragment),Ue=n(),ne=d("p"),ne.textContent=ot,he=n(),c(G.$$.fragment),_e=n(),ae=d("p"),this.h()},l(e){const a=ut("svelte-u9bgzb",document.head);x=i(a,"META",{name:!0,content:!0}),a.forEach(o),de=r(e),se=i(e,"P",{}),_(se).forEach(o),ie=r(e),p(A.$$.fragment,e),le=r(e),k=i(e,"P",{"data-svelte-h":!0}),v(k)!=="svelte-wbyqau"&&(k.innerHTML=Ge),ue=r(e),E=i(e,"P",{"data-svelte-h":!0}),v(E)!=="svelte-1vuni30"&&(E.textContent=Ne),ce=r(e),p(H.$$.fragment,e),pe=r(e),p(K.$$.fragment,e),me=r(e),s=i(e,"DIV",{class:!0});var l=_(s);p(O.$$.fragment,l),Te=r(l),N=i(l,"P",{"data-svelte-h":!0}),v(N)!=="svelte-1n3h3sv"&&(N.textContent=je),Le=r(l),j=i(l,"P",{"data-svelte-h":!0}),v(j)!=="svelte-km5dp"&&(j.innerHTML=Re),Ve=r(l),R=i(l,"DIV",{class:!0});var nt=_(R);p(P.$$.fragment,nt),nt.forEach(o),Ce=r(l),D=i(l,"DIV",{class:!0});var be=_(D);p(I.$$.fragment,be),Ae=r(be),Y=i(be,"P",{"data-svelte-h":!0}),v(Y)!=="svelte-189cc7b"&&(Y.innerHTML=Ye),be.forEach(o),ke=r(l),T=i(l,"DIV",{class:!0});var $e=_(T);p(M.$$.fragment,$e),Ee=r($e),J=i($e,"P",{"data-svelte-h":!0}),v(J)!=="svelte-1f366pl"&&(J.innerHTML=Je),$e.forEach(o),He=r(l),L=i(l,"DIV",{class:!0});var ye=_(L);p(F.$$.fragment,ye),Ke=r(ye),Q=i(ye,"P",{"data-svelte-h":!0}),v(Q)!=="svelte-14bnrb6"&&(Q.textContent=Qe),ye.forEach(o),Oe=r(l),V=i(l,"DIV",{class:!0});var xe=_(V);p(z.$$.fragment,xe),Pe=r(xe),X=i(xe,"P",{"data-svelte-h":!0}),v(X)!=="svelte-d46n0v"&&(X.textContent=Xe),xe.forEach(o),Ie=r(l),Z=i(l,"DIV",{class:!0});var rt=_(Z);p(B.$$.fragment,rt),rt.forEach(o),Me=r(l),C=i(l,"DIV",{class:!0});var we=_(C);p(W.$$.fragment,we),Fe=r(we),ee=i(we,"P",{"data-svelte-h":!0}),v(ee)!=="svelte-1b2tnvw"&&(ee.textContent=Ze),we.forEach(o),ze=r(l),$=i(l,"DIV",{class:!0});var re=_($);p(U.$$.fragment,re),Be=r(re),te=i(re,"P",{"data-svelte-h":!0}),v(te)!=="svelte-f5tuy8"&&(te.textContent=et),We=r(re),oe=i(re,"P",{"data-svelte-h":!0}),v(oe)!=="svelte-fqwmu"&&(oe.textContent=tt),re.forEach(o),l.forEach(o),fe=r(e),p(S.$$.fragment,e),ge=r(e),w=i(e,"DIV",{class:!0});var De=_(w);p(q.$$.fragment,De),Ue=r(De),ne=i(De,"P",{"data-svelte-h":!0}),v(ne)!=="svelte-18u8upa"&&(ne.textContent=ot),De.forEach(o),he=r(e),p(G.$$.fragment,e),_e=r(e),ae=i(e,"P",{}),_(ae).forEach(o),this.h()},h(){b(x,"name","hf:doc:metadata"),b(x,"content",ft),b(R,"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(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(Z,"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($,"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(w,"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,a){t(document.head,x),u(e,de,a),u(e,se,a),u(e,ie,a),m(A,e,a),u(e,le,a),u(e,k,a),u(e,ue,a),u(e,E,a),u(e,ce,a),m(H,e,a),u(e,pe,a),m(K,e,a),u(e,me,a),u(e,s,a),m(O,s,null),t(s,Te),t(s,N),t(s,Le),t(s,j),t(s,Ve),t(s,R),m(P,R,null),t(s,Ce),t(s,D),m(I,D,null),t(D,Ae),t(D,Y),t(s,ke),t(s,T),m(M,T,null),t(T,Ee),t(T,J),t(s,He),t(s,L),m(F,L,null),t(L,Ke),t(L,Q),t(s,Oe),t(s,V),m(z,V,null),t(V,Pe),t(V,X),t(s,Ie),t(s,Z),m(B,Z,null),t(s,Me),t(s,C),m(W,C,null),t(C,Fe),t(C,ee),t(s,ze),t(s,$),m(U,$,null),t($,Be),t($,te),t($,We),t($,oe),u(e,fe,a),m(S,e,a),u(e,ge,a),u(e,w,a),m(q,w,null),t(w,Ue),t(w,ne),u(e,he,a),m(G,e,a),u(e,_e,a),u(e,ae,a),ve=!0},p:at,i(e){ve||(f(A.$$.fragment,e),f(H.$$.fragment,e),f(K.$$.fragment,e),f(O.$$.fragment,e),f(P.$$.fragment,e),f(I.$$.fragment,e),f(M.$$.fragment,e),f(F.$$.fragment,e),f(z.$$.fragment,e),f(B.$$.fragment,e),f(W.$$.fragment,e),f(U.$$.fragment,e),f(S.$$.fragment,e),f(q.$$.fragment,e),f(G.$$.fragment,e),ve=!0)},o(e){g(A.$$.fragment,e),g(H.$$.fragment,e),g(K.$$.fragment,e),g(O.$$.fragment,e),g(P.$$.fragment,e),g(I.$$.fragment,e),g(M.$$.fragment,e),g(F.$$.fragment,e),g(z.$$.fragment,e),g(B.$$.fragment,e),g(W.$$.fragment,e),g(U.$$.fragment,e),g(S.$$.fragment,e),g(q.$$.fragment,e),g(G.$$.fragment,e),ve=!1},d(e){e&&(o(de),o(se),o(ie),o(le),o(k),o(ue),o(E),o(ce),o(pe),o(me),o(s),o(fe),o(ge),o(w),o(he),o(_e),o(ae)),o(x),h(A,e),h(H,e),h(K,e),h(O),h(P),h(I),h(M),h(F),h(z),h(B),h(W),h(U),h(S,e),h(q),h(G,e)}}}const ft='{"title":"AutoencoderKLHunyuanVideo","local":"autoencoderklhunyuanvideo","sections":[{"title":"AutoencoderKLMochi","local":"diffusers.AutoencoderKLHunyuanVideo","sections":[],"depth":2},{"title":"DecoderOutput","local":"diffusers.models.autoencoders.vae.DecoderOutput","sections":[],"depth":2}],"depth":1}';function gt(qe){return dt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class yt extends it{constructor(x){super(),lt(this,x,gt,mt,st,{})}}export{yt as component};
