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 m,A as it,h as d,f as n,c as r,j as _,u,x as v,k as b,y as t,a as c,v as p,d as f,t as g,w as h}from"../chunks/index.da70eac4.js";import{D as $}from"../chunks/Docstring.c021b19a.js";import{C as dt}from"../chunks/CodeBlock.a9c4becf.js";import{H as ze,E as lt}from"../chunks/getInferenceSnippets.725ed3d4.js";function ct(Ge){let w,ae,oe,se,E,ie,C,je='The 3D variational autoencoder (VAE) model with KL loss used in <a href="https://github.com/Wan-Video/Wan2.1" rel="nofollow">Wan 2.1</a> by the Alibaba Wan Team.',de,K,Ne="The model can be loaded with the following code snippet.",le,M,ce,V,me,a,k,Te,q,Fe=`A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos.
Introduced in [Wan 2.1].`,Le,R,qe=`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).`,We,U,I,Ae,y,O,De,S,Re=`Disable sliced VAE decoding. If <code>enable_slicing</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ee,T,J,Ce,X,Ue=`Disable tiled VAE decoding. If <code>enable_tiling</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ke,L,P,Me,Y,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.`,Ve,W,H,ke,B,Xe=`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,Z,Oe,A,z,Je,ee,Ye="Decode a batch of images using a tiled decoder.",Pe,D,G,He,te,Be="Encode a batch of images using a tiled encoder.",ue,j,pe,x,N,Ze,ne,Qe="Output of decoding method.",fe,F,ge,re,he;return E=new ze({props:{title:"AutoencoderKLWan",local:"autoencoderklwan",headingTag:"h1"}}),M=new dt({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xXYW4lMEElMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMV2FuLmZyb21fcHJldHJhaW5lZCglMjJXYW4tQUklMkZXYW4yLjEtVDJWLTEuM0ItRGlmZnVzZXJzJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydmFlJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDMyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLWan

vae = AutoencoderKLWan.from_pretrained(<span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-1.3B-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32)`,wrap:!1}}),V=new ze({props:{title:"AutoencoderKLWan",local:"diffusers.AutoencoderKLWan",headingTag:"h2"}}),k=new $({props:{name:"class diffusers.AutoencoderKLWan",anchor:"diffusers.AutoencoderKLWan",parameters:[{name:"base_dim",val:": int = 96"},{name:"decoder_base_dim",val:": typing.Optional[int] = None"},{name:"z_dim",val:": int = 16"},{name:"dim_mult",val:": typing.Tuple[int] = [1, 2, 4, 4]"},{name:"num_res_blocks",val:": int = 2"},{name:"attn_scales",val:": typing.List[float] = []"},{name:"temperal_downsample",val:": typing.List[bool] = [False, True, True]"},{name:"dropout",val:": float = 0.0"},{name:"latents_mean",val:": typing.List[float] = [-0.7571, -0.7089, -0.9113, 0.1075, -0.1745, 0.9653, -0.1517, 1.5508, 0.4134, -0.0715, 0.5517, -0.3632, -0.1922, -0.9497, 0.2503, -0.2921]"},{name:"latents_std",val:": typing.List[float] = [2.8184, 1.4541, 2.3275, 2.6558, 1.2196, 1.7708, 2.6052, 2.0743, 3.2687, 2.1526, 2.8652, 1.5579, 1.6382, 1.1253, 2.8251, 1.916]"},{name:"is_residual",val:": bool = False"},{name:"in_channels",val:": int = 3"},{name:"out_channels",val:": int = 3"},{name:"patch_size",val:": typing.Optional[int] = None"},{name:"scale_factor_temporal",val:": typing.Optional[int] = 4"},{name:"scale_factor_spatial",val:": typing.Optional[int] = 8"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L955"}}),I=new $({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLWan.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.AutoencoderKLWan.disable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1128"}}),J=new $({props:{name:"disable_tiling",anchor:"diffusers.AutoencoderKLWan.disable_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1114"}}),P=new $({props:{name:"enable_slicing",anchor:"diffusers.AutoencoderKLWan.enable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1121"}}),H=new $({props:{name:"enable_tiling",anchor:"diffusers.AutoencoderKLWan.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_stride_height",val:": typing.Optional[float] = None"},{name:"tile_sample_stride_width",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLWan.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.AutoencoderKLWan.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.AutoencoderKLWan.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.AutoencoderKLWan.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"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1084"}}),Z=new $({props:{name:"forward",anchor:"diffusers.AutoencoderKLWan.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.AutoencoderKLWan.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014; Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLWan.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_wan.py#L1399"}}),z=new $({props:{name:"tiled_decode",anchor:"diffusers.AutoencoderKLWan.tiled_decode",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLWan.tiled_decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLWan.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_wan.py#L1336",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>
`}}),G=new $({props:{name:"tiled_encode",anchor:"diffusers.AutoencoderKLWan.tiled_encode",parameters:[{name:"x",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLWan.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_wan.py#L1270",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 ze({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#L46"}}),F=new lt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoder_kl_wan.md"}}),{c(){w=i("meta"),ae=o(),oe=i("p"),se=o(),m(E.$$.fragment),ie=o(),C=i("p"),C.innerHTML=je,de=o(),K=i("p"),K.textContent=Ne,le=o(),m(M.$$.fragment),ce=o(),m(V.$$.fragment),me=o(),a=i("div"),m(k.$$.fragment),Te=o(),q=i("p"),q.textContent=Fe,Le=o(),R=i("p"),R.innerHTML=qe,We=o(),U=i("div"),m(I.$$.fragment),Ae=o(),y=i("div"),m(O.$$.fragment),De=o(),S=i("p"),S.innerHTML=Re,Ee=o(),T=i("div"),m(J.$$.fragment),Ce=o(),X=i("p"),X.innerHTML=Ue,Ke=o(),L=i("div"),m(P.$$.fragment),Me=o(),Y=i("p"),Y.textContent=Se,Ve=o(),W=i("div"),m(H.$$.fragment),ke=o(),B=i("p"),B.textContent=Xe,Ie=o(),Q=i("div"),m(Z.$$.fragment),Oe=o(),A=i("div"),m(z.$$.fragment),Je=o(),ee=i("p"),ee.textContent=Ye,Pe=o(),D=i("div"),m(G.$$.fragment),He=o(),te=i("p"),te.textContent=Be,ue=o(),m(j.$$.fragment),pe=o(),x=i("div"),m(N.$$.fragment),Ze=o(),ne=i("p"),ne.textContent=Qe,fe=o(),m(F.$$.fragment),ge=o(),re=i("p"),this.h()},l(e){const s=it("svelte-u9bgzb",document.head);w=d(s,"META",{name:!0,content:!0}),s.forEach(n),ae=r(e),oe=d(e,"P",{}),_(oe).forEach(n),se=r(e),u(E.$$.fragment,e),ie=r(e),C=d(e,"P",{"data-svelte-h":!0}),v(C)!=="svelte-tl45xs"&&(C.innerHTML=je),de=r(e),K=d(e,"P",{"data-svelte-h":!0}),v(K)!=="svelte-1vuni30"&&(K.textContent=Ne),le=r(e),u(M.$$.fragment,e),ce=r(e),u(V.$$.fragment,e),me=r(e),a=d(e,"DIV",{class:!0});var l=_(a);u(k.$$.fragment,l),Te=r(l),q=d(l,"P",{"data-svelte-h":!0}),v(q)!=="svelte-1cxmnva"&&(q.textContent=Fe),Le=r(l),R=d(l,"P",{"data-svelte-h":!0}),v(R)!=="svelte-1hyu2ru"&&(R.innerHTML=qe),We=r(l),U=d(l,"DIV",{class:!0});var et=_(U);u(I.$$.fragment,et),et.forEach(n),Ae=r(l),y=d(l,"DIV",{class:!0});var _e=_(y);u(O.$$.fragment,_e),De=r(_e),S=d(_e,"P",{"data-svelte-h":!0}),v(S)!=="svelte-189cc7b"&&(S.innerHTML=Re),_e.forEach(n),Ee=r(l),T=d(l,"DIV",{class:!0});var be=_(T);u(J.$$.fragment,be),Ce=r(be),X=d(be,"P",{"data-svelte-h":!0}),v(X)!=="svelte-1f366pl"&&(X.innerHTML=Ue),be.forEach(n),Ke=r(l),L=d(l,"DIV",{class:!0});var ve=_(L);u(P.$$.fragment,ve),Me=r(ve),Y=d(ve,"P",{"data-svelte-h":!0}),v(Y)!=="svelte-14bnrb6"&&(Y.textContent=Se),ve.forEach(n),Ve=r(l),W=d(l,"DIV",{class:!0});var $e=_(W);u(H.$$.fragment,$e),ke=r($e),B=d($e,"P",{"data-svelte-h":!0}),v(B)!=="svelte-1xwrf7t"&&(B.textContent=Xe),$e.forEach(n),Ie=r(l),Q=d(l,"DIV",{class:!0});var tt=_(Q);u(Z.$$.fragment,tt),tt.forEach(n),Oe=r(l),A=d(l,"DIV",{class:!0});var we=_(A);u(z.$$.fragment,we),Je=r(we),ee=d(we,"P",{"data-svelte-h":!0}),v(ee)!=="svelte-1vrxp2b"&&(ee.textContent=Ye),we.forEach(n),Pe=r(l),D=d(l,"DIV",{class:!0});var xe=_(D);u(G.$$.fragment,xe),He=r(xe),te=d(xe,"P",{"data-svelte-h":!0}),v(te)!=="svelte-1un5fcn"&&(te.textContent=Be),xe.forEach(n),l.forEach(n),ue=r(e),u(j.$$.fragment,e),pe=r(e),x=d(e,"DIV",{class:!0});var ye=_(x);u(N.$$.fragment,ye),Ze=r(ye),ne=d(ye,"P",{"data-svelte-h":!0}),v(ne)!=="svelte-18u8upa"&&(ne.textContent=Qe),ye.forEach(n),fe=r(e),u(F.$$.fragment,e),ge=r(e),re=d(e,"P",{}),_(re).forEach(n),this.h()},h(){b(w,"name","hf:doc:metadata"),b(w,"content",mt),b(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(y,"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(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(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(Q,"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(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(x,"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,w),c(e,ae,s),c(e,oe,s),c(e,se,s),p(E,e,s),c(e,ie,s),c(e,C,s),c(e,de,s),c(e,K,s),c(e,le,s),p(M,e,s),c(e,ce,s),p(V,e,s),c(e,me,s),c(e,a,s),p(k,a,null),t(a,Te),t(a,q),t(a,Le),t(a,R),t(a,We),t(a,U),p(I,U,null),t(a,Ae),t(a,y),p(O,y,null),t(y,De),t(y,S),t(a,Ee),t(a,T),p(J,T,null),t(T,Ce),t(T,X),t(a,Ke),t(a,L),p(P,L,null),t(L,Me),t(L,Y),t(a,Ve),t(a,W),p(H,W,null),t(W,ke),t(W,B),t(a,Ie),t(a,Q),p(Z,Q,null),t(a,Oe),t(a,A),p(z,A,null),t(A,Je),t(A,ee),t(a,Pe),t(a,D),p(G,D,null),t(D,He),t(D,te),c(e,ue,s),p(j,e,s),c(e,pe,s),c(e,x,s),p(N,x,null),t(x,Ze),t(x,ne),c(e,fe,s),p(F,e,s),c(e,ge,s),c(e,re,s),he=!0},p:ot,i(e){he||(f(E.$$.fragment,e),f(M.$$.fragment,e),f(V.$$.fragment,e),f(k.$$.fragment,e),f(I.$$.fragment,e),f(O.$$.fragment,e),f(J.$$.fragment,e),f(P.$$.fragment,e),f(H.$$.fragment,e),f(Z.$$.fragment,e),f(z.$$.fragment,e),f(G.$$.fragment,e),f(j.$$.fragment,e),f(N.$$.fragment,e),f(F.$$.fragment,e),he=!0)},o(e){g(E.$$.fragment,e),g(M.$$.fragment,e),g(V.$$.fragment,e),g(k.$$.fragment,e),g(I.$$.fragment,e),g(O.$$.fragment,e),g(J.$$.fragment,e),g(P.$$.fragment,e),g(H.$$.fragment,e),g(Z.$$.fragment,e),g(z.$$.fragment,e),g(G.$$.fragment,e),g(j.$$.fragment,e),g(N.$$.fragment,e),g(F.$$.fragment,e),he=!1},d(e){e&&(n(ae),n(oe),n(se),n(ie),n(C),n(de),n(K),n(le),n(ce),n(me),n(a),n(ue),n(pe),n(x),n(fe),n(ge),n(re)),n(w),h(E,e),h(M,e),h(V,e),h(k),h(I),h(O),h(J),h(P),h(H),h(Z),h(z),h(G),h(j,e),h(N),h(F,e)}}}const mt='{"title":"AutoencoderKLWan","local":"autoencoderklwan","sections":[{"title":"AutoencoderKLWan","local":"diffusers.AutoencoderKLWan","sections":[],"depth":2},{"title":"DecoderOutput","local":"diffusers.models.autoencoders.vae.DecoderOutput","sections":[],"depth":2}],"depth":1}';function ut(Ge){return rt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class bt extends at{constructor(w){super(),st(this,w,ut,ct,nt,{})}}export{bt as component};
