import{s as nt,n as ot,o as rt}from"../chunks/scheduler.8c3d61f6.js";import{S as st,i as at,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,se,oe,ae,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,qe="The model can be loaded with the following code snippet.",le,K,ue,C,ce,s,M,xe,N,Fe=`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,U,Ne=`This model inherits from <a href="/docs/diffusers/pr_10011/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,Ue=`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,q,Ge,ne,Qe="Output of decoding method.",fe,F,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/vr_10011/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/vr_10011/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/vr_10011/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/vr_10011/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/vr_10011/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/vr_10011/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/vr_10011/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/vr_10011/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/vr_10011/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"}}),q=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/vr_10011/src/diffusers/models/autoencoders/vae.py#L46"}}),F=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"),se=o(),oe=i("p"),ae=o(),c(A.$$.fragment),ie=o(),k=i("p"),k.innerHTML=Be,de=o(),E=i("p"),E.textContent=qe,le=o(),c(K.$$.fragment),ue=o(),c(C.$$.fragment),ce=o(),s=i("div"),c(M.$$.fragment),xe=o(),N=i("p"),N.innerHTML=Fe,Te=o(),U=i("p"),U.innerHTML=Ne,He=o(),z=i("div"),c(I.$$.fragment),Le=o(),V=i("div"),c(O.$$.fragment),De=o(),S=i("p"),S.innerHTML=Ue,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(q.$$.fragment),Ge=o(),ne=i("p"),ne.textContent=Qe,fe=o(),c(F.$$.fragment),ge=o(),re=i("p"),this.h()},l(e){const a=it("svelte-u9bgzb",document.head);y=d(a,"META",{name:!0,content:!0}),a.forEach(n),se=r(e),oe=d(e,"P",{}),_(oe).forEach(n),ae=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=qe),le=r(e),m(K.$$.fragment,e),ue=r(e),m(C.$$.fragment,e),ce=r(e),s=d(e,"DIV",{class:!0});var l=_(s);m(M.$$.fragment,l),xe=r(l),N=d(l,"P",{"data-svelte-h":!0}),b(N)!=="svelte-3xjavs"&&(N.innerHTML=Fe),Te=r(l),U=d(l,"P",{"data-svelte-h":!0}),b(U)!=="svelte-1qr6nap"&&(U.innerHTML=Ne),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=Ue),_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(q.$$.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(F.$$.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(s,"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,a){t(document.head,y),u(e,se,a),u(e,oe,a),u(e,ae,a),p(A,e,a),u(e,ie,a),u(e,k,a),u(e,de,a),u(e,E,a),u(e,le,a),p(K,e,a),u(e,ue,a),p(C,e,a),u(e,ce,a),u(e,s,a),p(M,s,null),t(s,xe),t(s,N),t(s,Te),t(s,U),t(s,He),t(s,z),p(I,z,null),t(s,Le),t(s,V),p(O,V,null),t(V,De),t(V,S),t(s,Ae),t(s,x),p(J,x,null),t(x,ke),t(x,R),t(s,Ee),t(s,T),p(P,T,null),t(T,Ke),t(T,X),t(s,Ce),t(s,H),p(Z,H,null),t(H,Me),t(H,Y),t(s,Ie),t(s,Q),p(G,Q,null),t(s,Oe),t(s,L),p(W,L,null),t(L,Je),t(L,ee),t(s,Pe),t(s,D),p(j,D,null),t(D,Ze),t(D,te),u(e,me,a),p(B,e,a),u(e,pe,a),u(e,w,a),p(q,w,null),t(w,Ge),t(w,ne),u(e,fe,a),p(F,e,a),u(e,ge,a),u(e,re,a),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(q.$$.fragment,e),f(F.$$.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(q.$$.fragment,e),g(F.$$.fragment,e),he=!1},d(e){e&&(n(se),n(oe),n(ae),n(ie),n(k),n(de),n(E),n(le),n(ue),n(ce),n(s),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(q),h(F,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 st{constructor(y){super(),at(this,y,mt,ut,nt,{})}}export{vt as component};
