Buckets:

HuggingFaceDocBuilder's picture
download
raw
16.3 kB
import{s as Ue,n as We,o as ze}from"../chunks/scheduler.53228c21.js";import{S as He,i as Ze,e as d,s as n,c as m,h as qe,a as l,d as t,b as r,f as b,g as u,j as x,k as w,l as a,m as s,n as p,t as f,o as g,p as h}from"../chunks/index.cac5d66a.js";import{C as Re}from"../chunks/CopyLLMTxtMenu.d3355f38.js";import{D as U}from"../chunks/Docstring.41979c71.js";import{C as Fe}from"../chunks/CodeBlock.606cbaf4.js";import{H as $e,E as Je}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.e4b76f09.js";function Ye(Ce){let _,Q,Y,ee,A,te,D,oe,y,Ee='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.',ne,K,Oe="The model can be loaded with the following code snippet.",re,k,ae,C,se,i,E,be,W,Ne=`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>.`,xe,z,je=`This model inherits from <a href="/docs/diffusers/pr_13803/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,M,O,Me,H,Ie="Decode a batch of images.",Le,L,N,Te,Z,Se="Encode a batch of images into latents.",Ae,T,j,De,q,Ge=`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,R,I,ie,S,de,v,G,Ke,F,Pe="Output of AutoencoderKL encoding method.",le,P,ce,$,V,ke,J,Ve="Output of decoding method.",me,B,ue,X,pe;return A=new Re({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),D=new $e({props:{title:"AutoencoderKLMagvit",local:"autoencoderklmagvit",headingTag:"h1"}}),k=new Fe({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}}),C=new $e({props:{title:"AutoencoderKLMagvit",local:"diffusers.AutoencoderKLMagvit",headingTag:"h2"}}),E=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:": 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_13803/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L665"}}),O=new U({props:{name:"decode",anchor:"diffusers.AutoencoderKLMagvit.decode",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMagvit.decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLMagvit.decode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to return a <code>~models.vae.DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13803/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L891",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>
`}}),N=new U({props:{name:"encode",anchor:"diffusers.AutoencoderKLMagvit.encode",parameters:[{name:"x",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMagvit.encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of images.",name:"x"},{anchor:"diffusers.AutoencoderKLMagvit.encode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to return a <code>~models.autoencoder_kl.AutoencoderKLOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13803/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L837",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>The latent representations of the encoded videos. If <code>return_dict</code> is True, a
<code>~models.autoencoder_kl.AutoencoderKLOutput</code> is returned, otherwise a plain <code>tuple</code> is returned.</p>
`}}),j=new U({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_13803/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L771"}}),I=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:": 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_13803/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L1046"}}),S=new $e({props:{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"}}),G=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/vr_13803/src/diffusers/models/modeling_outputs.py#L7"}}),P=new $e({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),V=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:": 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_13803/src/diffusers/models/autoencoders/vae.py#L46"}}),B=new Je({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_magvit.md"}}),{c(){_=d("meta"),Q=n(),Y=d("p"),ee=n(),m(A.$$.fragment),te=n(),m(D.$$.fragment),oe=n(),y=d("p"),y.innerHTML=Ee,ne=n(),K=d("p"),K.textContent=Oe,re=n(),m(k.$$.fragment),ae=n(),m(C.$$.fragment),se=n(),i=d("div"),m(E.$$.fragment),be=n(),W=d("p"),W.innerHTML=Ne,xe=n(),z=d("p"),z.innerHTML=je,we=n(),M=d("div"),m(O.$$.fragment),Me=n(),H=d("p"),H.textContent=Ie,Le=n(),L=d("div"),m(N.$$.fragment),Te=n(),Z=d("p"),Z.textContent=Se,Ae=n(),T=d("div"),m(j.$$.fragment),De=n(),q=d("p"),q.textContent=Ge,ye=n(),R=d("div"),m(I.$$.fragment),ie=n(),m(S.$$.fragment),de=n(),v=d("div"),m(G.$$.fragment),Ke=n(),F=d("p"),F.textContent=Pe,le=n(),m(P.$$.fragment),ce=n(),$=d("div"),m(V.$$.fragment),ke=n(),J=d("p"),J.textContent=Ve,me=n(),m(B.$$.fragment),ue=n(),X=d("p"),this.h()},l(e){const o=qe("svelte-u9bgzb",document.head);_=l(o,"META",{name:!0,content:!0}),o.forEach(t),Q=r(e),Y=l(e,"P",{}),b(Y).forEach(t),ee=r(e),u(A.$$.fragment,e),te=r(e),u(D.$$.fragment,e),oe=r(e),y=l(e,"P",{"data-svelte-h":!0}),x(y)!=="svelte-9t4ux3"&&(y.innerHTML=Ee),ne=r(e),K=l(e,"P",{"data-svelte-h":!0}),x(K)!=="svelte-1vuni30"&&(K.textContent=Oe),re=r(e),u(k.$$.fragment,e),ae=r(e),u(C.$$.fragment,e),se=r(e),i=l(e,"DIV",{class:!0});var c=b(i);u(E.$$.fragment,c),be=r(c),W=l(c,"P",{"data-svelte-h":!0}),x(W)!=="svelte-17d0uff"&&(W.innerHTML=Ne),xe=r(c),z=l(c,"P",{"data-svelte-h":!0}),x(z)!=="svelte-13nky0p"&&(z.innerHTML=je),we=r(c),M=l(c,"DIV",{class:!0});var fe=b(M);u(O.$$.fragment,fe),Me=r(fe),H=l(fe,"P",{"data-svelte-h":!0}),x(H)!=="svelte-pmyhd2"&&(H.textContent=Ie),fe.forEach(t),Le=r(c),L=l(c,"DIV",{class:!0});var ge=b(L);u(N.$$.fragment,ge),Te=r(ge),Z=l(ge,"P",{"data-svelte-h":!0}),x(Z)!=="svelte-h5bpgz"&&(Z.textContent=Se),ge.forEach(t),Ae=r(c),T=l(c,"DIV",{class:!0});var he=b(T);u(j.$$.fragment,he),De=r(he),q=l(he,"P",{"data-svelte-h":!0}),x(q)!=="svelte-1xwrf7t"&&(q.textContent=Ge),he.forEach(t),ye=r(c),R=l(c,"DIV",{class:!0});var Be=b(R);u(I.$$.fragment,Be),Be.forEach(t),c.forEach(t),ie=r(e),u(S.$$.fragment,e),de=r(e),v=l(e,"DIV",{class:!0});var _e=b(v);u(G.$$.fragment,_e),Ke=r(_e),F=l(_e,"P",{"data-svelte-h":!0}),x(F)!=="svelte-1vsc7ag"&&(F.textContent=Pe),_e.forEach(t),le=r(e),u(P.$$.fragment,e),ce=r(e),$=l(e,"DIV",{class:!0});var ve=b($);u(V.$$.fragment,ve),ke=r(ve),J=l(ve,"P",{"data-svelte-h":!0}),x(J)!=="svelte-18u8upa"&&(J.textContent=Ve),ve.forEach(t),me=r(e),u(B.$$.fragment,e),ue=r(e),X=l(e,"P",{}),b(X).forEach(t),this.h()},h(){w(_,"name","hf:doc:metadata"),w(_,"content",Xe),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(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(T,"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(i,"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){a(document.head,_),s(e,Q,o),s(e,Y,o),s(e,ee,o),p(A,e,o),s(e,te,o),p(D,e,o),s(e,oe,o),s(e,y,o),s(e,ne,o),s(e,K,o),s(e,re,o),p(k,e,o),s(e,ae,o),p(C,e,o),s(e,se,o),s(e,i,o),p(E,i,null),a(i,be),a(i,W),a(i,xe),a(i,z),a(i,we),a(i,M),p(O,M,null),a(M,Me),a(M,H),a(i,Le),a(i,L),p(N,L,null),a(L,Te),a(L,Z),a(i,Ae),a(i,T),p(j,T,null),a(T,De),a(T,q),a(i,ye),a(i,R),p(I,R,null),s(e,ie,o),p(S,e,o),s(e,de,o),s(e,v,o),p(G,v,null),a(v,Ke),a(v,F),s(e,le,o),p(P,e,o),s(e,ce,o),s(e,$,o),p(V,$,null),a($,ke),a($,J),s(e,me,o),p(B,e,o),s(e,ue,o),s(e,X,o),pe=!0},p:We,i(e){pe||(f(A.$$.fragment,e),f(D.$$.fragment,e),f(k.$$.fragment,e),f(C.$$.fragment,e),f(E.$$.fragment,e),f(O.$$.fragment,e),f(N.$$.fragment,e),f(j.$$.fragment,e),f(I.$$.fragment,e),f(S.$$.fragment,e),f(G.$$.fragment,e),f(P.$$.fragment,e),f(V.$$.fragment,e),f(B.$$.fragment,e),pe=!0)},o(e){g(A.$$.fragment,e),g(D.$$.fragment,e),g(k.$$.fragment,e),g(C.$$.fragment,e),g(E.$$.fragment,e),g(O.$$.fragment,e),g(N.$$.fragment,e),g(j.$$.fragment,e),g(I.$$.fragment,e),g(S.$$.fragment,e),g(G.$$.fragment,e),g(P.$$.fragment,e),g(V.$$.fragment,e),g(B.$$.fragment,e),pe=!1},d(e){e&&(t(Q),t(Y),t(ee),t(te),t(oe),t(y),t(ne),t(K),t(re),t(ae),t(se),t(i),t(ie),t(de),t(v),t(le),t(ce),t($),t(me),t(ue),t(X)),t(_),h(A,e),h(D,e),h(k,e),h(C,e),h(E),h(O),h(N),h(j),h(I),h(S,e),h(G),h(P,e),h(V),h(B,e)}}}const Xe='{"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 Qe(Ce){return ze(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class st extends He{constructor(_){super(),Ze(this,_,Qe,Ye,Ue,{})}}export{st as component};

Xet Storage Details

Size:
16.3 kB
·
Xet hash:
8436ac5a012b1d131130dfdd08ed491ee6df4810ab883c29aa72c603f3164b02

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