import{s as ot,n as at,o as st}from"../chunks/scheduler.53228c21.js";import{S as rt,i as it,e as i,s as a,c as u,h as lt,a as l,d as t,b as s,f as _,g as p,j as b,k as v,l as o,m as d,n as c,t as f,o as g,p as h}from"../chunks/index.100fac89.js";import{C as dt}from"../chunks/CopyLLMTxtMenu.9360b11d.js";import{D as $}from"../chunks/Docstring.22cc8849.js";import{C as mt}from"../chunks/CodeBlock.d30a6509.js";import{H as Te,E as ut}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c9001d7a.js";function pt(Ne){let w,re,ae,ie,D,le,k,de,E,We='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.',me,K,Ze="The model can be loaded with the following code snippet.",ue,C,pe,O,ce,r,V,De,R,qe=`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>.`,ke,z,Re=`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).`,Ee,F,I,Ke,J,j,Ce,L,P,Oe,Y,ze=`Disable sliced VAE decoding. If <code>enable_slicing</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ve,x,S,Ie,X,Fe=`Disable tiled VAE decoding. If <code>enable_tiling</code> was previously enabled, this method will go back to computing
decoding in one step.`,je,A,H,Pe,Q,Je=`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.`,Se,T,B,He,ee,Ye=`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.`,Be,te,U,fe,G,ge,M,N,Ue,ne,Xe="Output of AutoencoderKL encoding method.",he,W,_e,y,Z,Ge,oe,Qe="Output of decoding method.",ve,q,be,se,$e;return D=new dt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),k=new Te({props:{title:"AutoencoderKLMagvit",local:"autoencoderklmagvit",headingTag:"h1"}}),C=new mt({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}}),O=new Te({props:{title:"AutoencoderKLMagvit",local:"diffusers.AutoencoderKLMagvit",headingTag:"h2"}}),V=new $({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"}}),I=new $({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"}}),j=new $({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"}}),P=new $({props:{name:"disable_slicing",anchor:"diffusers.AutoencoderKLMagvit.disable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L822"}}),S=new $({props:{name:"disable_tiling",anchor:"diffusers.AutoencoderKLMagvit.disable_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L808"}}),H=new $({props:{name:"enable_slicing",anchor:"diffusers.AutoencoderKLMagvit.enable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L815"}}),B=new $({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"}}),U=new $({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#L1068"}}),G=new Te({props:{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"}}),N=new $({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"}}),W=new Te({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),Z=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#L47"}}),q=new ut({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_magvit.md"}}),{c(){w=i("meta"),re=a(),ae=i("p"),ie=a(),u(D.$$.fragment),le=a(),u(k.$$.fragment),de=a(),E=i("p"),E.innerHTML=We,me=a(),K=i("p"),K.textContent=Ze,ue=a(),u(C.$$.fragment),pe=a(),u(O.$$.fragment),ce=a(),r=i("div"),u(V.$$.fragment),De=a(),R=i("p"),R.innerHTML=qe,ke=a(),z=i("p"),z.innerHTML=Re,Ee=a(),F=i("div"),u(I.$$.fragment),Ke=a(),J=i("div"),u(j.$$.fragment),Ce=a(),L=i("div"),u(P.$$.fragment),Oe=a(),Y=i("p"),Y.innerHTML=ze,Ve=a(),x=i("div"),u(S.$$.fragment),Ie=a(),X=i("p"),X.innerHTML=Fe,je=a(),A=i("div"),u(H.$$.fragment),Pe=a(),Q=i("p"),Q.textContent=Je,Se=a(),T=i("div"),u(B.$$.fragment),He=a(),ee=i("p"),ee.textContent=Ye,Be=a(),te=i("div"),u(U.$$.fragment),fe=a(),u(G.$$.fragment),ge=a(),M=i("div"),u(N.$$.fragment),Ue=a(),ne=i("p"),ne.textContent=Xe,he=a(),u(W.$$.fragment),_e=a(),y=i("div"),u(Z.$$.fragment),Ge=a(),oe=i("p"),oe.textContent=Qe,ve=a(),u(q.$$.fragment),be=a(),se=i("p"),this.h()},l(e){const n=lt("svelte-u9bgzb",document.head);w=l(n,"META",{name:!0,content:!0}),n.forEach(t),re=s(e),ae=l(e,"P",{}),_(ae).forEach(t),ie=s(e),p(D.$$.fragment,e),le=s(e),p(k.$$.fragment,e),de=s(e),E=l(e,"P",{"data-svelte-h":!0}),b(E)!=="svelte-9t4ux3"&&(E.innerHTML=We),me=s(e),K=l(e,"P",{"data-svelte-h":!0}),b(K)!=="svelte-1vuni30"&&(K.textContent=Ze),ue=s(e),p(C.$$.fragment,e),pe=s(e),p(O.$$.fragment,e),ce=s(e),r=l(e,"DIV",{class:!0});var m=_(r);p(V.$$.fragment,m),De=s(m),R=l(m,"P",{"data-svelte-h":!0}),b(R)!=="svelte-17d0uff"&&(R.innerHTML=qe),ke=s(m),z=l(m,"P",{"data-svelte-h":!0}),b(z)!=="svelte-1hyu2ru"&&(z.innerHTML=Re),Ee=s(m),F=l(m,"DIV",{class:!0});var et=_(F);p(I.$$.fragment,et),et.forEach(t),Ke=s(m),J=l(m,"DIV",{class:!0});var tt=_(J);p(j.$$.fragment,tt),tt.forEach(t),Ce=s(m),L=l(m,"DIV",{class:!0});var we=_(L);p(P.$$.fragment,we),Oe=s(we),Y=l(we,"P",{"data-svelte-h":!0}),b(Y)!=="svelte-189cc7b"&&(Y.innerHTML=ze),we.forEach(t),Ve=s(m),x=l(m,"DIV",{class:!0});var Me=_(x);p(S.$$.fragment,Me),Ie=s(Me),X=l(Me,"P",{"data-svelte-h":!0}),b(X)!=="svelte-1f366pl"&&(X.innerHTML=Fe),Me.forEach(t),je=s(m),A=l(m,"DIV",{class:!0});var ye=_(A);p(H.$$.fragment,ye),Pe=s(ye),Q=l(ye,"P",{"data-svelte-h":!0}),b(Q)!=="svelte-14bnrb6"&&(Q.textContent=Je),ye.forEach(t),Se=s(m),T=l(m,"DIV",{class:!0});var Le=_(T);p(B.$$.fragment,Le),He=s(Le),ee=l(Le,"P",{"data-svelte-h":!0}),b(ee)!=="svelte-1xwrf7t"&&(ee.textContent=Ye),Le.forEach(t),Be=s(m),te=l(m,"DIV",{class:!0});var nt=_(te);p(U.$$.fragment,nt),nt.forEach(t),m.forEach(t),fe=s(e),p(G.$$.fragment,e),ge=s(e),M=l(e,"DIV",{class:!0});var xe=_(M);p(N.$$.fragment,xe),Ue=s(xe),ne=l(xe,"P",{"data-svelte-h":!0}),b(ne)!=="svelte-1vsc7ag"&&(ne.textContent=Xe),xe.forEach(t),he=s(e),p(W.$$.fragment,e),_e=s(e),y=l(e,"DIV",{class:!0});var Ae=_(y);p(Z.$$.fragment,Ae),Ge=s(Ae),oe=l(Ae,"P",{"data-svelte-h":!0}),b(oe)!=="svelte-18u8upa"&&(oe.textContent=Qe),Ae.forEach(t),ve=s(e),p(q.$$.fragment,e),be=s(e),se=l(e,"P",{}),_(se).forEach(t),this.h()},h(){v(w,"name","hf:doc:metadata"),v(w,"content",ct),v(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(J,"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(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(A,"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(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(r,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(M,"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")},m(e,n){o(document.head,w),d(e,re,n),d(e,ae,n),d(e,ie,n),c(D,e,n),d(e,le,n),c(k,e,n),d(e,de,n),d(e,E,n),d(e,me,n),d(e,K,n),d(e,ue,n),c(C,e,n),d(e,pe,n),c(O,e,n),d(e,ce,n),d(e,r,n),c(V,r,null),o(r,De),o(r,R),o(r,ke),o(r,z),o(r,Ee),o(r,F),c(I,F,null),o(r,Ke),o(r,J),c(j,J,null),o(r,Ce),o(r,L),c(P,L,null),o(L,Oe),o(L,Y),o(r,Ve),o(r,x),c(S,x,null),o(x,Ie),o(x,X),o(r,je),o(r,A),c(H,A,null),o(A,Pe),o(A,Q),o(r,Se),o(r,T),c(B,T,null),o(T,He),o(T,ee),o(r,Be),o(r,te),c(U,te,null),d(e,fe,n),c(G,e,n),d(e,ge,n),d(e,M,n),c(N,M,null),o(M,Ue),o(M,ne),d(e,he,n),c(W,e,n),d(e,_e,n),d(e,y,n),c(Z,y,null),o(y,Ge),o(y,oe),d(e,ve,n),c(q,e,n),d(e,be,n),d(e,se,n),$e=!0},p:at,i(e){$e||(f(D.$$.fragment,e),f(k.$$.fragment,e),f(C.$$.fragment,e),f(O.$$.fragment,e),f(V.$$.fragment,e),f(I.$$.fragment,e),f(j.$$.fragment,e),f(P.$$.fragment,e),f(S.$$.fragment,e),f(H.$$.fragment,e),f(B.$$.fragment,e),f(U.$$.fragment,e),f(G.$$.fragment,e),f(N.$$.fragment,e),f(W.$$.fragment,e),f(Z.$$.fragment,e),f(q.$$.fragment,e),$e=!0)},o(e){g(D.$$.fragment,e),g(k.$$.fragment,e),g(C.$$.fragment,e),g(O.$$.fragment,e),g(V.$$.fragment,e),g(I.$$.fragment,e),g(j.$$.fragment,e),g(P.$$.fragment,e),g(S.$$.fragment,e),g(H.$$.fragment,e),g(B.$$.fragment,e),g(U.$$.fragment,e),g(G.$$.fragment,e),g(N.$$.fragment,e),g(W.$$.fragment,e),g(Z.$$.fragment,e),g(q.$$.fragment,e),$e=!1},d(e){e&&(t(re),t(ae),t(ie),t(le),t(de),t(E),t(me),t(K),t(ue),t(pe),t(ce),t(r),t(fe),t(ge),t(M),t(he),t(_e),t(y),t(ve),t(be),t(se)),t(w),h(D,e),h(k,e),h(C,e),h(O,e),h(V),h(I),h(j),h(P),h(S),h(H),h(B),h(U),h(G,e),h(N),h(W,e),h(Z),h(q,e)}}}const ct='{"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 ft(Ne){return st(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class wt extends rt{constructor(w){super(),it(this,w,ft,pt,ot,{})}}export{wt as component};
