import{s as Ve,n as Be,o as Ie}from"../chunks/scheduler.53228c21.js";import{S as Pe,i as Ue,e as l,s as o,c as p,h as Ge,a as d,d as t,b as a,f as b,g as u,j as P,k as w,l as i,m as s,n as c,t as f,o as g,p as h}from"../chunks/index.100fac89.js";import{C as He}from"../chunks/CopyLLMTxtMenu.494046bd.js";import{D as U}from"../chunks/Docstring.9bbf7d33.js";import{C as Ne}from"../chunks/CodeBlock.d30a6509.js";import{H as ge,E as We}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.8999c127.js";function Ze(xe){let _,Y,J,X,y,Q,L,ee,x,Te='The 3D variational autoencoder (VAE) model with KL loss used in <a href="https://github.com/aigc-apps/EasyAnimate" rel="nofollow">EasyAnimate</a> was introduced by Alibaba PAI.',te,T,Ae="The model can be loaded with the following code snippet.",ne,A,oe,D,ae,r,k,he,G,De=`A VAE model with KL loss for encoding images into latents and decoding latent representations into images. This
model is used in <a href="https://huggingface.co/papers/2405.18991" rel="nofollow">EasyAnimate</a>.`,_e,H,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).`,ve,N,K,$e,W,E,be,M,O,we,Z,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.`,Me,q,C,se,j,re,v,S,ye,R,Ee="Output of AutoencoderKL encoding method.",ie,V,le,$,B,Le,F,Oe="Output of decoding method.",de,I,me,z,pe;return y=new He({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),L=new ge({props:{title:"AutoencoderKLMagvit",local:"autoencoderklmagvit",headingTag:"h1"}}),A=new Ne({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xNYWd2aXQlMEElMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMTWFndml0LmZyb21fcHJldHJhaW5lZCglMjJhbGliYWJhLXBhaSUyRkVhc3lBbmltYXRlVjUuMS0xMmItemglMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ2YWUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLMagvit

vae = AutoencoderKLMagvit.from_pretrained(<span class="hljs-string">&quot;alibaba-pai/EasyAnimateV5.1-12b-zh&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),D=new ge({props:{title:"AutoencoderKLMagvit",local:"diffusers.AutoencoderKLMagvit",headingTag:"h2"}}),k=new U({props:{name:"class diffusers.AutoencoderKLMagvit",anchor:"diffusers.AutoencoderKLMagvit",parameters:[{name:"in_channels",val:": int = 3"},{name:"latent_channels",val:": int = 16"},{name:"out_channels",val:": int = 3"},{name:"block_out_channels",val:": typing.Tuple[int, ...] = [128, 256, 512, 512]"},{name:"down_block_types",val:": typing.Tuple[str, ...] = ['SpatialDownBlock3D', 'SpatialTemporalDownBlock3D', 'SpatialTemporalDownBlock3D', 'SpatialTemporalDownBlock3D']"},{name:"up_block_types",val:": typing.Tuple[str, ...] = ['SpatialUpBlock3D', 'SpatialTemporalUpBlock3D', 'SpatialTemporalUpBlock3D', 'SpatialTemporalUpBlock3D']"},{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.7125"},{name:"spatial_group_norm",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L666"}}),K=new U({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLMagvit.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/accelerate_utils.py#L43"}}),E=new U({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLMagvit.encode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/accelerate_utils.py#L43"}}),O=new U({props:{name:"enable_tiling",anchor:"diffusers.AutoencoderKLMagvit.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.AutoencoderKLMagvit.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.AutoencoderKLMagvit.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.AutoencoderKLMagvit.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.AutoencoderKLMagvit.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_magvit.py#L772"}}),C=new U({props:{name:"forward",anchor:"diffusers.AutoencoderKLMagvit.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.AutoencoderKLMagvit.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014; Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLMagvit.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.AutoencoderKLMagvit.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_magvit.py#L1047"}}),j=new ge({props:{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"}}),S=new U({props:{name:"class diffusers.models.modeling_outputs.AutoencoderKLOutput",anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput",parameters:[{name:"latent_dist",val:": DiagonalGaussianDistribution"}],parametersDescription:[{anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput.latent_dist",description:`<strong>latent_dist</strong> (<code>DiagonalGaussianDistribution</code>) &#x2014;
Encoded outputs of <code>Encoder</code> represented as the mean and logvar of <code>DiagonalGaussianDistribution</code>.
<code>DiagonalGaussianDistribution</code> allows for sampling latents from the distribution.`,name:"latent_dist"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_outputs.py#L7"}}),V=new ge({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),B=new U({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"}}),I=new We({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_magvit.md"}}),{c(){_=l("meta"),Y=o(),J=l("p"),X=o(),p(y.$$.fragment),Q=o(),p(L.$$.fragment),ee=o(),x=l("p"),x.innerHTML=Te,te=o(),T=l("p"),T.textContent=Ae,ne=o(),p(A.$$.fragment),oe=o(),p(D.$$.fragment),ae=o(),r=l("div"),p(k.$$.fragment),he=o(),G=l("p"),G.innerHTML=De,_e=o(),H=l("p"),H.innerHTML=ke,ve=o(),N=l("div"),p(K.$$.fragment),$e=o(),W=l("div"),p(E.$$.fragment),be=o(),M=l("div"),p(O.$$.fragment),we=o(),Z=l("p"),Z.textContent=Ke,Me=o(),q=l("div"),p(C.$$.fragment),se=o(),p(j.$$.fragment),re=o(),v=l("div"),p(S.$$.fragment),ye=o(),R=l("p"),R.textContent=Ee,ie=o(),p(V.$$.fragment),le=o(),$=l("div"),p(B.$$.fragment),Le=o(),F=l("p"),F.textContent=Oe,de=o(),p(I.$$.fragment),me=o(),z=l("p"),this.h()},l(e){const n=Ge("svelte-u9bgzb",document.head);_=d(n,"META",{name:!0,content:!0}),n.forEach(t),Y=a(e),J=d(e,"P",{}),b(J).forEach(t),X=a(e),u(y.$$.fragment,e),Q=a(e),u(L.$$.fragment,e),ee=a(e),x=d(e,"P",{"data-svelte-h":!0}),P(x)!=="svelte-9t4ux3"&&(x.innerHTML=Te),te=a(e),T=d(e,"P",{"data-svelte-h":!0}),P(T)!=="svelte-1vuni30"&&(T.textContent=Ae),ne=a(e),u(A.$$.fragment,e),oe=a(e),u(D.$$.fragment,e),ae=a(e),r=d(e,"DIV",{class:!0});var m=b(r);u(k.$$.fragment,m),he=a(m),G=d(m,"P",{"data-svelte-h":!0}),P(G)!=="svelte-17d0uff"&&(G.innerHTML=De),_e=a(m),H=d(m,"P",{"data-svelte-h":!0}),P(H)!=="svelte-1hyu2ru"&&(H.innerHTML=ke),ve=a(m),N=d(m,"DIV",{class:!0});var Ce=b(N);u(K.$$.fragment,Ce),Ce.forEach(t),$e=a(m),W=d(m,"DIV",{class:!0});var je=b(W);u(E.$$.fragment,je),je.forEach(t),be=a(m),M=d(m,"DIV",{class:!0});var ue=b(M);u(O.$$.fragment,ue),we=a(ue),Z=d(ue,"P",{"data-svelte-h":!0}),P(Z)!=="svelte-1xwrf7t"&&(Z.textContent=Ke),ue.forEach(t),Me=a(m),q=d(m,"DIV",{class:!0});var Se=b(q);u(C.$$.fragment,Se),Se.forEach(t),m.forEach(t),se=a(e),u(j.$$.fragment,e),re=a(e),v=d(e,"DIV",{class:!0});var ce=b(v);u(S.$$.fragment,ce),ye=a(ce),R=d(ce,"P",{"data-svelte-h":!0}),P(R)!=="svelte-1vsc7ag"&&(R.textContent=Ee),ce.forEach(t),ie=a(e),u(V.$$.fragment,e),le=a(e),$=d(e,"DIV",{class:!0});var fe=b($);u(B.$$.fragment,fe),Le=a(fe),F=d(fe,"P",{"data-svelte-h":!0}),P(F)!=="svelte-18u8upa"&&(F.textContent=Oe),fe.forEach(t),de=a(e),u(I.$$.fragment,e),me=a(e),z=d(e,"P",{}),b(z).forEach(t),this.h()},h(){w(_,"name","hf:doc:metadata"),w(_,"content",qe),w(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(r,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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,n){i(document.head,_),s(e,Y,n),s(e,J,n),s(e,X,n),c(y,e,n),s(e,Q,n),c(L,e,n),s(e,ee,n),s(e,x,n),s(e,te,n),s(e,T,n),s(e,ne,n),c(A,e,n),s(e,oe,n),c(D,e,n),s(e,ae,n),s(e,r,n),c(k,r,null),i(r,he),i(r,G),i(r,_e),i(r,H),i(r,ve),i(r,N),c(K,N,null),i(r,$e),i(r,W),c(E,W,null),i(r,be),i(r,M),c(O,M,null),i(M,we),i(M,Z),i(r,Me),i(r,q),c(C,q,null),s(e,se,n),c(j,e,n),s(e,re,n),s(e,v,n),c(S,v,null),i(v,ye),i(v,R),s(e,ie,n),c(V,e,n),s(e,le,n),s(e,$,n),c(B,$,null),i($,Le),i($,F),s(e,de,n),c(I,e,n),s(e,me,n),s(e,z,n),pe=!0},p:Be,i(e){pe||(f(y.$$.fragment,e),f(L.$$.fragment,e),f(A.$$.fragment,e),f(D.$$.fragment,e),f(k.$$.fragment,e),f(K.$$.fragment,e),f(E.$$.fragment,e),f(O.$$.fragment,e),f(C.$$.fragment,e),f(j.$$.fragment,e),f(S.$$.fragment,e),f(V.$$.fragment,e),f(B.$$.fragment,e),f(I.$$.fragment,e),pe=!0)},o(e){g(y.$$.fragment,e),g(L.$$.fragment,e),g(A.$$.fragment,e),g(D.$$.fragment,e),g(k.$$.fragment,e),g(K.$$.fragment,e),g(E.$$.fragment,e),g(O.$$.fragment,e),g(C.$$.fragment,e),g(j.$$.fragment,e),g(S.$$.fragment,e),g(V.$$.fragment,e),g(B.$$.fragment,e),g(I.$$.fragment,e),pe=!1},d(e){e&&(t(Y),t(J),t(X),t(Q),t(ee),t(x),t(te),t(T),t(ne),t(oe),t(ae),t(r),t(se),t(re),t(v),t(ie),t(le),t($),t(de),t(me),t(z)),t(_),h(y,e),h(L,e),h(A,e),h(D,e),h(k),h(K),h(E),h(O),h(C),h(j,e),h(S),h(V,e),h(B),h(I,e)}}}const qe='{"title":"AutoencoderKLMagvit","local":"autoencoderklmagvit","sections":[{"title":"AutoencoderKLMagvit","local":"diffusers.AutoencoderKLMagvit","sections":[],"depth":2},{"title":"AutoencoderKLOutput","local":"diffusers.models.modeling_outputs.AutoencoderKLOutput","sections":[],"depth":2},{"title":"DecoderOutput","local":"diffusers.models.autoencoders.vae.DecoderOutput","sections":[],"depth":2}],"depth":1}';function Re(xe){return Ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class et extends Pe{constructor(_){super(),Ue(this,_,Re,Ze,Ve,{})}}export{et as component};
