Buckets:

download
raw
14.6 kB
import{s as Se,n as Ge,o as Ve}from"../chunks/scheduler.53228c21.js";import{S as Be,i as Ie,e as l,s as n,c as u,h as Pe,a as d,d as t,b as r,f as b,g as c,j as B,k as w,l as i,m as a,n as p,t as f,o as g,p as h}from"../chunks/index.cac5d66a.js";import{C as Ue}from"../chunks/CopyLLMTxtMenu.0ef49226.js";import{D as I}from"../chunks/Docstring.9de32ff4.js";import{C as He}from"../chunks/CodeBlock.606cbaf4.js";import{H as ge,E as We}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.48d5cb47.js";function Ze(ye){let _,Y,J,X,L,Q,x,ee,y,De='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,D,Ae="The model can be loaded with the following code snippet.",oe,A,ne,T,re,s,k,he,P,Te=`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,U,ke=`This model inherits from <a href="/docs/diffusers/pr_13921/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,H,K,$e,W,E,be,M,C,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,N,ae,O,se,v,j,Le,R,Ee="Output of AutoencoderKL encoding method.",ie,S,le,$,G,xe,F,Ce="Output of decoding method.",de,V,me,z,ue;return L=new Ue({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),x=new ge({props:{title:"AutoencoderKLMagvit",local:"autoencoderklmagvit",headingTag:"h1"}}),A=new He({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>)`,lang:"python",wrap:!1}}),T=new ge({props:{title:"AutoencoderKLMagvit",local:"diffusers.AutoencoderKLMagvit",headingTag:"h2"}}),k=new I({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:": tuple = [128, 256, 512, 512]"},{name:"down_block_types",val:": tuple = ['SpatialDownBlock3D', 'SpatialTemporalDownBlock3D', 'SpatialTemporalDownBlock3D', 'SpatialTemporalDownBlock3D']"},{name:"up_block_types",val:": tuple = ['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/vr_13921/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L665"}}),K=new I({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLMagvit.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/utils/accelerate_utils.py#L43"}}),E=new I({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLMagvit.encode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/utils/accelerate_utils.py#L43"}}),C=new I({props:{name:"enable_tiling",anchor:"diffusers.AutoencoderKLMagvit.enable_tiling",parameters:[{name:"tile_sample_min_height",val:": int | None = None"},{name:"tile_sample_min_width",val:": int | None = None"},{name:"tile_sample_min_num_frames",val:": int | None = None"},{name:"tile_sample_stride_height",val:": float | None = None"},{name:"tile_sample_stride_width",val:": float | None = None"},{name:"tile_sample_stride_num_frames",val:": float | None = 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/vr_13921/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L771"}}),N=new I({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:": torch._C.Generator | None = 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"},{anchor:"diffusers.AutoencoderKLMagvit.forward.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make sampling
deterministic.`,name:"generator"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L1046",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>If <code>return_dict</code> 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>
`}}),O=new ge({props:{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"}}),j=new I({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/vr_13921/src/diffusers/models/modeling_outputs.py#L7"}}),S=new ge({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),G=new I({props:{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",parameters:[{name:"sample",val:": Tensor"},{name:"commit_loss",val:": torch.FloatTensor | None = 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_13921/src/diffusers/models/autoencoders/vae.py#L46"}}),V=new We({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_magvit.md"}}),{c(){_=l("meta"),Y=n(),J=l("p"),X=n(),u(L.$$.fragment),Q=n(),u(x.$$.fragment),ee=n(),y=l("p"),y.innerHTML=De,te=n(),D=l("p"),D.textContent=Ae,oe=n(),u(A.$$.fragment),ne=n(),u(T.$$.fragment),re=n(),s=l("div"),u(k.$$.fragment),he=n(),P=l("p"),P.innerHTML=Te,_e=n(),U=l("p"),U.innerHTML=ke,ve=n(),H=l("div"),u(K.$$.fragment),$e=n(),W=l("div"),u(E.$$.fragment),be=n(),M=l("div"),u(C.$$.fragment),we=n(),Z=l("p"),Z.textContent=Ke,Me=n(),q=l("div"),u(N.$$.fragment),ae=n(),u(O.$$.fragment),se=n(),v=l("div"),u(j.$$.fragment),Le=n(),R=l("p"),R.textContent=Ee,ie=n(),u(S.$$.fragment),le=n(),$=l("div"),u(G.$$.fragment),xe=n(),F=l("p"),F.textContent=Ce,de=n(),u(V.$$.fragment),me=n(),z=l("p"),this.h()},l(e){const o=Pe("svelte-u9bgzb",document.head);_=d(o,"META",{name:!0,content:!0}),o.forEach(t),Y=r(e),J=d(e,"P",{}),b(J).forEach(t),X=r(e),c(L.$$.fragment,e),Q=r(e),c(x.$$.fragment,e),ee=r(e),y=d(e,"P",{"data-svelte-h":!0}),B(y)!=="svelte-9t4ux3"&&(y.innerHTML=De),te=r(e),D=d(e,"P",{"data-svelte-h":!0}),B(D)!=="svelte-1vuni30"&&(D.textContent=Ae),oe=r(e),c(A.$$.fragment,e),ne=r(e),c(T.$$.fragment,e),re=r(e),s=d(e,"DIV",{class:!0});var m=b(s);c(k.$$.fragment,m),he=r(m),P=d(m,"P",{"data-svelte-h":!0}),B(P)!=="svelte-17d0uff"&&(P.innerHTML=Te),_e=r(m),U=d(m,"P",{"data-svelte-h":!0}),B(U)!=="svelte-j24tt4"&&(U.innerHTML=ke),ve=r(m),H=d(m,"DIV",{class:!0});var Ne=b(H);c(K.$$.fragment,Ne),Ne.forEach(t),$e=r(m),W=d(m,"DIV",{class:!0});var Oe=b(W);c(E.$$.fragment,Oe),Oe.forEach(t),be=r(m),M=d(m,"DIV",{class:!0});var ce=b(M);c(C.$$.fragment,ce),we=r(ce),Z=d(ce,"P",{"data-svelte-h":!0}),B(Z)!=="svelte-1xwrf7t"&&(Z.textContent=Ke),ce.forEach(t),Me=r(m),q=d(m,"DIV",{class:!0});var je=b(q);c(N.$$.fragment,je),je.forEach(t),m.forEach(t),ae=r(e),c(O.$$.fragment,e),se=r(e),v=d(e,"DIV",{class:!0});var pe=b(v);c(j.$$.fragment,pe),Le=r(pe),R=d(pe,"P",{"data-svelte-h":!0}),B(R)!=="svelte-1vsc7ag"&&(R.textContent=Ee),pe.forEach(t),ie=r(e),c(S.$$.fragment,e),le=r(e),$=d(e,"DIV",{class:!0});var fe=b($);c(G.$$.fragment,fe),xe=r(fe),F=d(fe,"P",{"data-svelte-h":!0}),B(F)!=="svelte-18u8upa"&&(F.textContent=Ce),fe.forEach(t),de=r(e),c(V.$$.fragment,e),me=r(e),z=d(e,"P",{}),b(z).forEach(t),this.h()},h(){w(_,"name","hf:doc:metadata"),w(_,"content",qe),w(H,"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(s,"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,o){i(document.head,_),a(e,Y,o),a(e,J,o),a(e,X,o),p(L,e,o),a(e,Q,o),p(x,e,o),a(e,ee,o),a(e,y,o),a(e,te,o),a(e,D,o),a(e,oe,o),p(A,e,o),a(e,ne,o),p(T,e,o),a(e,re,o),a(e,s,o),p(k,s,null),i(s,he),i(s,P),i(s,_e),i(s,U),i(s,ve),i(s,H),p(K,H,null),i(s,$e),i(s,W),p(E,W,null),i(s,be),i(s,M),p(C,M,null),i(M,we),i(M,Z),i(s,Me),i(s,q),p(N,q,null),a(e,ae,o),p(O,e,o),a(e,se,o),a(e,v,o),p(j,v,null),i(v,Le),i(v,R),a(e,ie,o),p(S,e,o),a(e,le,o),a(e,$,o),p(G,$,null),i($,xe),i($,F),a(e,de,o),p(V,e,o),a(e,me,o),a(e,z,o),ue=!0},p:Ge,i(e){ue||(f(L.$$.fragment,e),f(x.$$.fragment,e),f(A.$$.fragment,e),f(T.$$.fragment,e),f(k.$$.fragment,e),f(K.$$.fragment,e),f(E.$$.fragment,e),f(C.$$.fragment,e),f(N.$$.fragment,e),f(O.$$.fragment,e),f(j.$$.fragment,e),f(S.$$.fragment,e),f(G.$$.fragment,e),f(V.$$.fragment,e),ue=!0)},o(e){g(L.$$.fragment,e),g(x.$$.fragment,e),g(A.$$.fragment,e),g(T.$$.fragment,e),g(k.$$.fragment,e),g(K.$$.fragment,e),g(E.$$.fragment,e),g(C.$$.fragment,e),g(N.$$.fragment,e),g(O.$$.fragment,e),g(j.$$.fragment,e),g(S.$$.fragment,e),g(G.$$.fragment,e),g(V.$$.fragment,e),ue=!1},d(e){e&&(t(Y),t(J),t(X),t(Q),t(ee),t(y),t(te),t(D),t(oe),t(ne),t(re),t(s),t(ae),t(se),t(v),t(ie),t(le),t($),t(de),t(me),t(z)),t(_),h(L,e),h(x,e),h(A,e),h(T,e),h(k),h(K),h(E),h(C),h(N),h(O,e),h(j),h(S,e),h(G),h(V,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(ye){return Ve(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class et extends Be{constructor(_){super(),Ie(this,_,Re,Ze,Se,{})}}export{et as component};

Xet Storage Details

Size:
14.6 kB
·
Xet hash:
e7f4033c71e79743447c9fb39fa2601a88542c31e5def16971a1264171935b98

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.