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 je,E as lt}from"../chunks/EditOnGithub.1e64e623.js";function ut(Be){let y,se,oe,ae,A,ie,k,Je='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,K,Ue="The model can be loaded with the following code snippet.",le,E,ue,C,ce,s,M,xe,z,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>.`,He,F,ze=`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).`,Te,S,O,Le,V,I,De,q,Fe=`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,P,ke,R,Se=`Disable tiled VAE decoding. If <code>enable_tiling</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ke,H,Z,Ee,X,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.`,Ce,T,G,Me,Q,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.`,Oe,Y,W,Ie,L,j,Pe,ee,Xe="Decode a batch of images using a tiled decoder.",Ze,D,B,Ge,te,Qe="Encode a batch of images using a tiled encoder.",me,J,pe,w,U,We,ne,Ye="Output of decoding method.",fe,N,ge,re,he;return A=new je({props:{title:"AutoencoderKLHunyuanVideo",local:"autoencoderklhunyuanvideo",headingTag:"h1"}}),E=new dt({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xIdW55dWFuVmlkZW8lMEElMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMSHVueXVhblZpZGVvLmZyb21fcHJldHJhaW5lZCglMjJ0ZW5jZW50JTJGSHVueXVhblZpZGVvJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLHunyuanVideo

vae = AutoencoderKLHunyuanVideo.from_pretrained(<span class="hljs-string">&quot;tencent/HunyuanVideo&quot;</span>, torch_dtype=torch.float16)`,wrap:!1}}),C=new je({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_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L703"}}),O=new $({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 $({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#L860"}}),P=new $({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#L846"}}),Z=new $({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#L853"}}),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/vr_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L806"}}),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/vr_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L1153"}}),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/vr_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L1028",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/vr_10136/src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py#L978",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>
`}}),J=new je({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),U=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_10136/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"),se=o(),oe=i("p"),ae=o(),c(A.$$.fragment),ie=o(),k=i("p"),k.innerHTML=Je,de=o(),K=i("p"),K.textContent=Ue,le=o(),c(E.$$.fragment),ue=o(),c(C.$$.fragment),ce=o(),s=i("div"),c(M.$$.fragment),xe=o(),z=i("p"),z.innerHTML=Ne,He=o(),F=i("p"),F.innerHTML=ze,Te=o(),S=i("div"),c(O.$$.fragment),Le=o(),V=i("div"),c(I.$$.fragment),De=o(),q=i("p"),q.innerHTML=Fe,Ae=o(),x=i("div"),c(P.$$.fragment),ke=o(),R=i("p"),R.innerHTML=Se,Ke=o(),H=i("div"),c(Z.$$.fragment),Ee=o(),X=i("p"),X.textContent=qe,Ce=o(),T=i("div"),c(G.$$.fragment),Me=o(),Q=i("p"),Q.textContent=Re,Oe=o(),Y=i("div"),c(W.$$.fragment),Ie=o(),L=i("div"),c(j.$$.fragment),Pe=o(),ee=i("p"),ee.textContent=Xe,Ze=o(),D=i("div"),c(B.$$.fragment),Ge=o(),te=i("p"),te.textContent=Qe,me=o(),c(J.$$.fragment),pe=o(),w=i("div"),c(U.$$.fragment),We=o(),ne=i("p"),ne.textContent=Ye,fe=o(),c(N.$$.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=Je),de=r(e),K=d(e,"P",{"data-svelte-h":!0}),b(K)!=="svelte-1vuni30"&&(K.textContent=Ue),le=r(e),m(E.$$.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),z=d(l,"P",{"data-svelte-h":!0}),b(z)!=="svelte-3xjavs"&&(z.innerHTML=Ne),He=r(l),F=d(l,"P",{"data-svelte-h":!0}),b(F)!=="svelte-km5dp"&&(F.innerHTML=ze),Te=r(l),S=d(l,"DIV",{class:!0});var et=_(S);m(O.$$.fragment,et),et.forEach(n),Le=r(l),V=d(l,"DIV",{class:!0});var _e=_(V);m(I.$$.fragment,_e),De=r(_e),q=d(_e,"P",{"data-svelte-h":!0}),b(q)!=="svelte-189cc7b"&&(q.innerHTML=Fe),_e.forEach(n),Ae=r(l),x=d(l,"DIV",{class:!0});var ve=_(x);m(P.$$.fragment,ve),ke=r(ve),R=d(ve,"P",{"data-svelte-h":!0}),b(R)!=="svelte-1f366pl"&&(R.innerHTML=Se),ve.forEach(n),Ke=r(l),H=d(l,"DIV",{class:!0});var be=_(H);m(Z.$$.fragment,be),Ee=r(be),X=d(be,"P",{"data-svelte-h":!0}),b(X)!=="svelte-14bnrb6"&&(X.textContent=qe),be.forEach(n),Ce=r(l),T=d(l,"DIV",{class:!0});var $e=_(T);m(G.$$.fragment,$e),Me=r($e),Q=d($e,"P",{"data-svelte-h":!0}),b(Q)!=="svelte-1xwrf7t"&&(Q.textContent=Re),$e.forEach(n),Oe=r(l),Y=d(l,"DIV",{class:!0});var tt=_(Y);m(W.$$.fragment,tt),tt.forEach(n),Ie=r(l),L=d(l,"DIV",{class:!0});var ye=_(L);m(j.$$.fragment,ye),Pe=r(ye),ee=d(ye,"P",{"data-svelte-h":!0}),b(ee)!=="svelte-1vrxp2b"&&(ee.textContent=Xe),ye.forEach(n),Ze=r(l),D=d(l,"DIV",{class:!0});var we=_(D);m(B.$$.fragment,we),Ge=r(we),te=d(we,"P",{"data-svelte-h":!0}),b(te)!=="svelte-1un5fcn"&&(te.textContent=Qe),we.forEach(n),l.forEach(n),me=r(e),m(J.$$.fragment,e),pe=r(e),w=d(e,"DIV",{class:!0});var Ve=_(w);m(U.$$.fragment,Ve),We=r(Ve),ne=d(Ve,"P",{"data-svelte-h":!0}),b(ne)!=="svelte-18u8upa"&&(ne.textContent=Ye),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(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(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(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(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(Y,"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,K,a),u(e,le,a),p(E,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,z),t(s,He),t(s,F),t(s,Te),t(s,S),p(O,S,null),t(s,Le),t(s,V),p(I,V,null),t(V,De),t(V,q),t(s,Ae),t(s,x),p(P,x,null),t(x,ke),t(x,R),t(s,Ke),t(s,H),p(Z,H,null),t(H,Ee),t(H,X),t(s,Ce),t(s,T),p(G,T,null),t(T,Me),t(T,Q),t(s,Oe),t(s,Y),p(W,Y,null),t(s,Ie),t(s,L),p(j,L,null),t(L,Pe),t(L,ee),t(s,Ze),t(s,D),p(B,D,null),t(D,Ge),t(D,te),u(e,me,a),p(J,e,a),u(e,pe,a),u(e,w,a),p(U,w,null),t(w,We),t(w,ne),u(e,fe,a),p(N,e,a),u(e,ge,a),u(e,re,a),he=!0},p:ot,i(e){he||(f(A.$$.fragment,e),f(E.$$.fragment,e),f(C.$$.fragment,e),f(M.$$.fragment,e),f(O.$$.fragment,e),f(I.$$.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(J.$$.fragment,e),f(U.$$.fragment,e),f(N.$$.fragment,e),he=!0)},o(e){g(A.$$.fragment,e),g(E.$$.fragment,e),g(C.$$.fragment,e),g(M.$$.fragment,e),g(O.$$.fragment,e),g(I.$$.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(J.$$.fragment,e),g(U.$$.fragment,e),g(N.$$.fragment,e),he=!1},d(e){e&&(n(se),n(oe),n(ae),n(ie),n(k),n(de),n(K),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(E,e),h(C,e),h(M),h(O),h(I),h(P),h(Z),h(G),h(W),h(j),h(B),h(J,e),h(U),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(Be){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};
