import{s as nt,n as ot,o as rt}from"../chunks/scheduler.8c3d61f6.js";import{S as at,i as st,g as i,s as o,r as c,A as it,h as d,f as n,c as r,j as _,u as m,x as b,k as v,y as t,a as u,v as p,d as f,t as g,w as h}from"../chunks/index.da70eac4.js";import{D as $}from"../chunks/Docstring.6b390b9a.js";import{C as dt}from"../chunks/CodeBlock.00a903b3.js";import{H as We,E as lt}from"../chunks/EditOnGithub.1e64e623.js";function ut(je){let y,ae,oe,se,A,ie,k,Be='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.',de,E,Fe="The model can be loaded with the following code snippet.",le,K,ue,C,ce,a,M,xe,U,Ne=`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>.`,Te,q,Ue=`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).`,He,z,I,Le,V,O,De,S,qe=`Disable sliced VAE decoding. If <code>enable_slicing</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ae,x,J,ke,R,ze=`Disable tiled VAE decoding. If <code>enable_tiling</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ee,T,P,Ke,X,Se=`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.`,Ce,H,Z,Me,Y,Re=`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.`,Ie,Q,G,Oe,L,W,Je,ee,Xe="Decode a batch of images using a tiled decoder.",Pe,D,j,Ze,te,Ye="Encode a batch of images using a tiled encoder.",me,B,pe,w,F,Ge,ne,Qe="Output of decoding method.",fe,N,ge,re,he;return A=new We({props:{title:"AutoencoderKLHunyuanVideo",local:"autoencoderklhunyuanvideo",headingTag:"h1"}}),K=new dt({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}}),C=new We({props:{title:"AutoencoderKLHunyuanVideo",local:"diffusers.AutoencoderKLHunyuanVideo",headingTag:"h2"}}),M=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#L704"}}),I=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"}}),O=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#L861"}}),J=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#L847"}}),P=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#L854"}}),Z=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#L807"}}),G=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#L1154"}}),W=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#L1029",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 $({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#L979",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>
`}}),B=new We({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),F=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#L46"}}),N=new lt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoder_kl_hunyuan_video.md"}}),{c(){y=i("meta"),ae=o(),oe=i("p"),se=o(),c(A.$$.fragment),ie=o(),k=i("p"),k.innerHTML=Be,de=o(),E=i("p"),E.textContent=Fe,le=o(),c(K.$$.fragment),ue=o(),c(C.$$.fragment),ce=o(),a=i("div"),c(M.$$.fragment),xe=o(),U=i("p"),U.innerHTML=Ne,Te=o(),q=i("p"),q.innerHTML=Ue,He=o(),z=i("div"),c(I.$$.fragment),Le=o(),V=i("div"),c(O.$$.fragment),De=o(),S=i("p"),S.innerHTML=qe,Ae=o(),x=i("div"),c(J.$$.fragment),ke=o(),R=i("p"),R.innerHTML=ze,Ee=o(),T=i("div"),c(P.$$.fragment),Ke=o(),X=i("p"),X.textContent=Se,Ce=o(),H=i("div"),c(Z.$$.fragment),Me=o(),Y=i("p"),Y.textContent=Re,Ie=o(),Q=i("div"),c(G.$$.fragment),Oe=o(),L=i("div"),c(W.$$.fragment),Je=o(),ee=i("p"),ee.textContent=Xe,Pe=o(),D=i("div"),c(j.$$.fragment),Ze=o(),te=i("p"),te.textContent=Ye,me=o(),c(B.$$.fragment),pe=o(),w=i("div"),c(F.$$.fragment),Ge=o(),ne=i("p"),ne.textContent=Qe,fe=o(),c(N.$$.fragment),ge=o(),re=i("p"),this.h()},l(e){const s=it("svelte-u9bgzb",document.head);y=d(s,"META",{name:!0,content:!0}),s.forEach(n),ae=r(e),oe=d(e,"P",{}),_(oe).forEach(n),se=r(e),m(A.$$.fragment,e),ie=r(e),k=d(e,"P",{"data-svelte-h":!0}),b(k)!=="svelte-wbyqau"&&(k.innerHTML=Be),de=r(e),E=d(e,"P",{"data-svelte-h":!0}),b(E)!=="svelte-1vuni30"&&(E.textContent=Fe),le=r(e),m(K.$$.fragment,e),ue=r(e),m(C.$$.fragment,e),ce=r(e),a=d(e,"DIV",{class:!0});var l=_(a);m(M.$$.fragment,l),xe=r(l),U=d(l,"P",{"data-svelte-h":!0}),b(U)!=="svelte-3xjavs"&&(U.innerHTML=Ne),Te=r(l),q=d(l,"P",{"data-svelte-h":!0}),b(q)!=="svelte-1hyu2ru"&&(q.innerHTML=Ue),He=r(l),z=d(l,"DIV",{class:!0});var et=_(z);m(I.$$.fragment,et),et.forEach(n),Le=r(l),V=d(l,"DIV",{class:!0});var _e=_(V);m(O.$$.fragment,_e),De=r(_e),S=d(_e,"P",{"data-svelte-h":!0}),b(S)!=="svelte-189cc7b"&&(S.innerHTML=qe),_e.forEach(n),Ae=r(l),x=d(l,"DIV",{class:!0});var ve=_(x);m(J.$$.fragment,ve),ke=r(ve),R=d(ve,"P",{"data-svelte-h":!0}),b(R)!=="svelte-1f366pl"&&(R.innerHTML=ze),ve.forEach(n),Ee=r(l),T=d(l,"DIV",{class:!0});var be=_(T);m(P.$$.fragment,be),Ke=r(be),X=d(be,"P",{"data-svelte-h":!0}),b(X)!=="svelte-14bnrb6"&&(X.textContent=Se),be.forEach(n),Ce=r(l),H=d(l,"DIV",{class:!0});var $e=_(H);m(Z.$$.fragment,$e),Me=r($e),Y=d($e,"P",{"data-svelte-h":!0}),b(Y)!=="svelte-1xwrf7t"&&(Y.textContent=Re),$e.forEach(n),Ie=r(l),Q=d(l,"DIV",{class:!0});var tt=_(Q);m(G.$$.fragment,tt),tt.forEach(n),Oe=r(l),L=d(l,"DIV",{class:!0});var ye=_(L);m(W.$$.fragment,ye),Je=r(ye),ee=d(ye,"P",{"data-svelte-h":!0}),b(ee)!=="svelte-1vrxp2b"&&(ee.textContent=Xe),ye.forEach(n),Pe=r(l),D=d(l,"DIV",{class:!0});var we=_(D);m(j.$$.fragment,we),Ze=r(we),te=d(we,"P",{"data-svelte-h":!0}),b(te)!=="svelte-1un5fcn"&&(te.textContent=Ye),we.forEach(n),l.forEach(n),me=r(e),m(B.$$.fragment,e),pe=r(e),w=d(e,"DIV",{class:!0});var Ve=_(w);m(F.$$.fragment,Ve),Ge=r(Ve),ne=d(Ve,"P",{"data-svelte-h":!0}),b(ne)!=="svelte-18u8upa"&&(ne.textContent=Qe),Ve.forEach(n),fe=r(e),m(N.$$.fragment,e),ge=r(e),re=d(e,"P",{}),_(re).forEach(n),this.h()},h(){v(y,"name","hf:doc:metadata"),v(y,"content",ct),v(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(a,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(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,s){t(document.head,y),u(e,ae,s),u(e,oe,s),u(e,se,s),p(A,e,s),u(e,ie,s),u(e,k,s),u(e,de,s),u(e,E,s),u(e,le,s),p(K,e,s),u(e,ue,s),p(C,e,s),u(e,ce,s),u(e,a,s),p(M,a,null),t(a,xe),t(a,U),t(a,Te),t(a,q),t(a,He),t(a,z),p(I,z,null),t(a,Le),t(a,V),p(O,V,null),t(V,De),t(V,S),t(a,Ae),t(a,x),p(J,x,null),t(x,ke),t(x,R),t(a,Ee),t(a,T),p(P,T,null),t(T,Ke),t(T,X),t(a,Ce),t(a,H),p(Z,H,null),t(H,Me),t(H,Y),t(a,Ie),t(a,Q),p(G,Q,null),t(a,Oe),t(a,L),p(W,L,null),t(L,Je),t(L,ee),t(a,Pe),t(a,D),p(j,D,null),t(D,Ze),t(D,te),u(e,me,s),p(B,e,s),u(e,pe,s),u(e,w,s),p(F,w,null),t(w,Ge),t(w,ne),u(e,fe,s),p(N,e,s),u(e,ge,s),u(e,re,s),he=!0},p:ot,i(e){he||(f(A.$$.fragment,e),f(K.$$.fragment,e),f(C.$$.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),he=!0)},o(e){g(A.$$.fragment,e),g(K.$$.fragment,e),g(C.$$.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),he=!1},d(e){e&&(n(ae),n(oe),n(se),n(ie),n(k),n(de),n(E),n(le),n(ue),n(ce),n(a),n(me),n(pe),n(w),n(fe),n(ge),n(re)),n(y),h(A,e),h(K,e),h(C,e),h(M),h(I),h(O),h(J),h(P),h(Z),h(G),h(W),h(j),h(B,e),h(F),h(N,e)}}}const ct='{"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 mt(je){return rt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class vt extends at{constructor(y){super(),st(this,y,mt,ut,nt,{})}}export{vt as component};
