import{s as Je,n as Ze,o as Ge}from"../chunks/scheduler.53228c21.js";import{S as Pe,i as We,e as s,s as o,c as m,h as je,a as d,d as t,b as r,f as y,g as c,j as V,k as b,l as a,m as l,n as p,t as f,o as h,p as g}from"../chunks/index.100fac89.js";import{C as Be}from"../chunks/CopyLLMTxtMenu.20a72e0e.js";import{D as P}from"../chunks/Docstring.49101787.js";import{C as Fe}from"../chunks/CodeBlock.d30a6509.js";import{H as Te,E as Ne}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.4d82655d.js";function Ue(He){let _,X,z,Y,T,Q,H,ee,L,Le='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.',te,D,De="The model can be loaded with the following code snippet.",ne,A,oe,k,re,i,K,fe,W,Ae=`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,j,ke=`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).`,ge,B,C,_e,$,M,ve,F,Ke=`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.`,ye,N,E,be,w,O,$e,U,Ce="Decode a batch of images using a tiled decoder.",we,x,I,xe,q,Me="Encode a batch of images using a tiled encoder.",ae,J,ie,v,Z,Ve,S,Ee="Output of decoding method.",se,G,de,R,le;return T=new Be({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),H=new Te({props:{title:"AutoencoderKLHunyuanVideo",local:"autoencoderklhunyuanvideo",headingTag:"h1"}}),A=new Fe({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}}),k=new Te({props:{title:"AutoencoderKLHunyuanVideo",local:"diffusers.AutoencoderKLHunyuanVideo",headingTag:"h2"}}),K=new P({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#L627"}}),C=new P({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"}}),M=new P({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#L726"}}),E=new P({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#L1052"}}),O=new P({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#L927",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>
`}}),I=new P({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#L877",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 Te({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),Z=new P({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"}}),G=new Ne({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoder_kl_hunyuan_video.md"}}),{c(){_=s("meta"),X=o(),z=s("p"),Y=o(),m(T.$$.fragment),Q=o(),m(H.$$.fragment),ee=o(),L=s("p"),L.innerHTML=Le,te=o(),D=s("p"),D.textContent=De,ne=o(),m(A.$$.fragment),oe=o(),m(k.$$.fragment),re=o(),i=s("div"),m(K.$$.fragment),fe=o(),W=s("p"),W.innerHTML=Ae,he=o(),j=s("p"),j.innerHTML=ke,ge=o(),B=s("div"),m(C.$$.fragment),_e=o(),$=s("div"),m(M.$$.fragment),ve=o(),F=s("p"),F.textContent=Ke,ye=o(),N=s("div"),m(E.$$.fragment),be=o(),w=s("div"),m(O.$$.fragment),$e=o(),U=s("p"),U.textContent=Ce,we=o(),x=s("div"),m(I.$$.fragment),xe=o(),q=s("p"),q.textContent=Me,ae=o(),m(J.$$.fragment),ie=o(),v=s("div"),m(Z.$$.fragment),Ve=o(),S=s("p"),S.textContent=Ee,se=o(),m(G.$$.fragment),de=o(),R=s("p"),this.h()},l(e){const n=je("svelte-u9bgzb",document.head);_=d(n,"META",{name:!0,content:!0}),n.forEach(t),X=r(e),z=d(e,"P",{}),y(z).forEach(t),Y=r(e),c(T.$$.fragment,e),Q=r(e),c(H.$$.fragment,e),ee=r(e),L=d(e,"P",{"data-svelte-h":!0}),V(L)!=="svelte-wbyqau"&&(L.innerHTML=Le),te=r(e),D=d(e,"P",{"data-svelte-h":!0}),V(D)!=="svelte-1vuni30"&&(D.textContent=De),ne=r(e),c(A.$$.fragment,e),oe=r(e),c(k.$$.fragment,e),re=r(e),i=d(e,"DIV",{class:!0});var u=y(i);c(K.$$.fragment,u),fe=r(u),W=d(u,"P",{"data-svelte-h":!0}),V(W)!=="svelte-3xjavs"&&(W.innerHTML=Ae),he=r(u),j=d(u,"P",{"data-svelte-h":!0}),V(j)!=="svelte-1hyu2ru"&&(j.innerHTML=ke),ge=r(u),B=d(u,"DIV",{class:!0});var Oe=y(B);c(C.$$.fragment,Oe),Oe.forEach(t),_e=r(u),$=d(u,"DIV",{class:!0});var ue=y($);c(M.$$.fragment,ue),ve=r(ue),F=d(ue,"P",{"data-svelte-h":!0}),V(F)!=="svelte-1xwrf7t"&&(F.textContent=Ke),ue.forEach(t),ye=r(u),N=d(u,"DIV",{class:!0});var Ie=y(N);c(E.$$.fragment,Ie),Ie.forEach(t),be=r(u),w=d(u,"DIV",{class:!0});var me=y(w);c(O.$$.fragment,me),$e=r(me),U=d(me,"P",{"data-svelte-h":!0}),V(U)!=="svelte-1vrxp2b"&&(U.textContent=Ce),me.forEach(t),we=r(u),x=d(u,"DIV",{class:!0});var ce=y(x);c(I.$$.fragment,ce),xe=r(ce),q=d(ce,"P",{"data-svelte-h":!0}),V(q)!=="svelte-1un5fcn"&&(q.textContent=Me),ce.forEach(t),u.forEach(t),ae=r(e),c(J.$$.fragment,e),ie=r(e),v=d(e,"DIV",{class:!0});var pe=y(v);c(Z.$$.fragment,pe),Ve=r(pe),S=d(pe,"P",{"data-svelte-h":!0}),V(S)!=="svelte-18u8upa"&&(S.textContent=Ee),pe.forEach(t),se=r(e),c(G.$$.fragment,e),de=r(e),R=d(e,"P",{}),y(R).forEach(t),this.h()},h(){b(_,"name","hf:doc:metadata"),b(_,"content",qe),b(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($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(N,"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"),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(i,"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")},m(e,n){a(document.head,_),l(e,X,n),l(e,z,n),l(e,Y,n),p(T,e,n),l(e,Q,n),p(H,e,n),l(e,ee,n),l(e,L,n),l(e,te,n),l(e,D,n),l(e,ne,n),p(A,e,n),l(e,oe,n),p(k,e,n),l(e,re,n),l(e,i,n),p(K,i,null),a(i,fe),a(i,W),a(i,he),a(i,j),a(i,ge),a(i,B),p(C,B,null),a(i,_e),a(i,$),p(M,$,null),a($,ve),a($,F),a(i,ye),a(i,N),p(E,N,null),a(i,be),a(i,w),p(O,w,null),a(w,$e),a(w,U),a(i,we),a(i,x),p(I,x,null),a(x,xe),a(x,q),l(e,ae,n),p(J,e,n),l(e,ie,n),l(e,v,n),p(Z,v,null),a(v,Ve),a(v,S),l(e,se,n),p(G,e,n),l(e,de,n),l(e,R,n),le=!0},p:Ze,i(e){le||(f(T.$$.fragment,e),f(H.$$.fragment,e),f(A.$$.fragment,e),f(k.$$.fragment,e),f(K.$$.fragment,e),f(C.$$.fragment,e),f(M.$$.fragment,e),f(E.$$.fragment,e),f(O.$$.fragment,e),f(I.$$.fragment,e),f(J.$$.fragment,e),f(Z.$$.fragment,e),f(G.$$.fragment,e),le=!0)},o(e){h(T.$$.fragment,e),h(H.$$.fragment,e),h(A.$$.fragment,e),h(k.$$.fragment,e),h(K.$$.fragment,e),h(C.$$.fragment,e),h(M.$$.fragment,e),h(E.$$.fragment,e),h(O.$$.fragment,e),h(I.$$.fragment,e),h(J.$$.fragment,e),h(Z.$$.fragment,e),h(G.$$.fragment,e),le=!1},d(e){e&&(t(X),t(z),t(Y),t(Q),t(ee),t(L),t(te),t(D),t(ne),t(oe),t(re),t(i),t(ae),t(ie),t(v),t(se),t(de),t(R)),t(_),g(T,e),g(H,e),g(A,e),g(k,e),g(K),g(C),g(M),g(E),g(O),g(I),g(J,e),g(Z),g(G,e)}}}const qe='{"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 Se(He){return Ge(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class tt extends Pe{constructor(_){super(),We(this,_,Se,Ue,Je,{})}}export{tt as component};
