import{s as rt,n as at,o as it}from"../chunks/scheduler.53228c21.js";import{S as st,i as dt,e as s,s as o,c,h as lt,a as d,d as n,b as r,f as _,g as m,j as v,k as b,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.4f0519ef.js";import{D as $}from"../chunks/Docstring.d02a9fa5.js";import{C as ct}from"../chunks/CodeBlock.d30a6509.js";import{H as Be,E as mt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.62dbb7c4.js";function pt(Fe){let y,ie,re,se,A,de,k,le,C,Ne='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,Ue="The model can be loaded with the following code snippet.",ce,K,me,M,pe,a,I,He,q,qe=`A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos.
Introduced in <a href="https://huggingface.co/papers/2412.03603" rel="nofollow">HunyuanVideo</a>.`,Le,z,ze=`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).`,De,S,O,Ae,V,J,ke,R,Se=`Disable sliced VAE decoding. If <code>enable_slicing</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ce,x,P,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,T,Z,Me,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.`,Ie,H,G,Oe,Q,Ye=`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 images.`,Je,ee,W,Pe,L,j,Ze,te,Qe="Decode a batch of images using a tiled decoder.",Ge,D,B,We,ne,et="Encode a batch of images using a tiled encoder.",fe,F,ge,w,N,je,oe,tt="Output of decoding method.",he,U,_e,ae,be;return A=new ut({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),k=new Be({props:{title:"AutoencoderKLHunyuanVideo",local:"autoencoderklhunyuanvideo",headingTag:"h1"}}),K=new ct({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xIdW55dWFuVmlkZW8lMEElMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMSHVueXVhblZpZGVvLmZyb21fcHJldHJhaW5lZCglMjJodW55dWFudmlkZW8tY29tbXVuaXR5JTJGSHVueXVhblZpZGVvJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydmFlJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLHunyuanVideo

vae = AutoencoderKLHunyuanVideo.from_pretrained(<span class="hljs-string">&quot;hunyuanvideo-community/HunyuanVideo&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float16)`,wrap:!1}}),M=new Be({props:{title:"AutoencoderKLHunyuanVideo",local:"diffusers.AutoencoderKLHunyuanVideo",headingTag:"h2"}}),I=new $({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, ...] = ('HunyuanVideoDownBlock3D', 'HunyuanVideoDownBlock3D', 'HunyuanVideoDownBlock3D', 'HunyuanVideoDownBlock3D')"},{name:"up_block_types",val:": typing.Tuple[str, ...] = ('HunyuanVideoUpBlock3D', 'HunyuanVideoUpBlock3D', 'HunyuanVideoUpBlock3D', 'HunyuanVideoUpBlock3D')"},{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:"scaling_factor",val:": float = 0.476986"},{name:"spatial_compression_ratio",val:": int = 8"},{name:"temporal_compression_ratio",val:": int = 4"},{name:"mid_block_add_attention",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L628"}}),O=new $({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLHunyuanVideo.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 $({props:{name:"disable_slicing",anchor:"diffusers.AutoencoderKLHunyuanVideo.disable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L781"}}),P=new $({props:{name:"disable_tiling",anchor:"diffusers.AutoencoderKLHunyuanVideo.disable_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L767"}}),Z=new $({props:{name:"enable_slicing",anchor:"diffusers.AutoencoderKLHunyuanVideo.enable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L774"}}),G=new $({props:{name:"enable_tiling",anchor:"diffusers.AutoencoderKLHunyuanVideo.enable_tiling",parameters:[{name:"tile_sample_min_height",val:": typing.Optional[int] = None"},{name:"tile_sample_min_width",val:": typing.Optional[int] = None"},{name:"tile_sample_min_num_frames",val:": typing.Optional[int] = None"},{name:"tile_sample_stride_height",val:": typing.Optional[float] = None"},{name:"tile_sample_stride_width",val:": typing.Optional[float] = None"},{name:"tile_sample_stride_num_frames",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanVideo.enable_tiling.tile_sample_min_height",description:`<strong>tile_sample_min_height</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The minimum height required for a sample to be separated into tiles across the height dimension.`,name:"tile_sample_min_height"},{anchor:"diffusers.AutoencoderKLHunyuanVideo.enable_tiling.tile_sample_min_width",description:`<strong>tile_sample_min_width</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The minimum width required for a sample to be separated into tiles across the width dimension.`,name:"tile_sample_min_width"},{anchor:"diffusers.AutoencoderKLHunyuanVideo.enable_tiling.tile_sample_min_num_frames",description:`<strong>tile_sample_min_num_frames</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The minimum number of frames required for a sample to be separated into tiles across the frame
dimension.`,name:"tile_sample_min_num_frames"},{anchor:"diffusers.AutoencoderKLHunyuanVideo.enable_tiling.tile_sample_stride_height",description:`<strong>tile_sample_stride_height</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The minimum amount of overlap between two consecutive vertical tiles. This is to ensure that there are
no tiling artifacts produced across the height dimension.`,name:"tile_sample_stride_height"},{anchor:"diffusers.AutoencoderKLHunyuanVideo.enable_tiling.tile_sample_stride_width",description:`<strong>tile_sample_stride_width</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The stride between two consecutive horizontal tiles. This is to ensure that there are no tiling
artifacts produced across the width dimension.`,name:"tile_sample_stride_width"},{anchor:"diffusers.AutoencoderKLHunyuanVideo.enable_tiling.tile_sample_stride_num_frames",description:`<strong>tile_sample_stride_num_frames</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The stride between two consecutive frame tiles. This is to ensure that there are no tiling artifacts
produced across the frame dimension.`,name:"tile_sample_stride_num_frames"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L727"}}),W=new $({props:{name:"forward",anchor:"diffusers.AutoencoderKLHunyuanVideo.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.AutoencoderKLHunyuanVideo.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</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/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L1074"}}),j=new $({props:{name:"tiled_decode",anchor:"diffusers.AutoencoderKLHunyuanVideo.tiled_decode",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanVideo.tiled_decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLHunyuanVideo.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_hunyuan_video.py#L949",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>
`}}),B=new $({props:{name:"tiled_encode",anchor:"diffusers.AutoencoderKLHunyuanVideo.tiled_encode",parameters:[{name:"x",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanVideo.tiled_encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of videos.",name:"x"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L899",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


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