Buckets:
| import"../chunks/DsnmJJEf.js";import{i as G,h as B,C as S,H as n,a as U,D as o,E as W,s as I}from"../chunks/BtE7mKSK.js";import{p as Z,o as z,s as e,f as R,a as A,b as V,c as t,d as T,n as a,r}from"../chunks/jDjavuwI.js";const q='{"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}';var F=T('<meta name="hf:doc:metadata"/>'),J=T(`<p></p> <!> <!> <p>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.</p> <p>The model can be loaded with the following code snippet.</p> <!> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>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>.</p> <p>This model inherits from <a href="/docs/diffusers/pr_14246/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).</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Decode a batch of images.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Encode a batch of images into latents.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>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.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Output of AutoencoderKL encoding method.</p></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Output of decoding method.</p></div> <!> <p></p>`,1);function X(x,y){Z(y,!1),z(()=>{new URLSearchParams(window.location.search).get("fw")}),G();var p=J();B("1mr8a4m",L=>{var w=F();I(w,"content",q),A(L,w)});var m=e(R(p),2);S(m,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var h=e(m,2);n(h,{title:"AutoencoderKLMagvit",local:"autoencoderklmagvit",headingTag:"h1"});var g=e(h,6);U(g,{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">"alibaba-pai/EasyAnimateV5.1-12b-zh"</span>, subfolder=<span class="hljs-string">"vae"</span>, torch_dtype=torch.float16).to(<span class="hljs-string">"cuda"</span>)`,lang:"python",wrap:!1});var f=e(g,2);n(f,{title:"AutoencoderKLMagvit",local:"diffusers.AutoencoderKLMagvit",headingTag:"h2"});var s=e(f,2),_=t(s);o(_,{name:"class diffusers.AutoencoderKLMagvit",anchor:"diffusers.AutoencoderKLMagvit",source:"https://github.com/huggingface/diffusers/blob/vr_14246/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L665",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"}]});var i=e(_,6),D=t(i);o(D,{name:"decode",anchor:"diffusers.AutoencoderKLMagvit.decode",source:"https://github.com/huggingface/diffusers/blob/vr_14246/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L891",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>) — 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>) — | |
| Whether to return a <code>~models.vae.DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"}],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> | |
| `}),a(2),r(i);var d=e(i,2),K=t(d);o(K,{name:"encode",anchor:"diffusers.AutoencoderKLMagvit.encode",source:"https://github.com/huggingface/diffusers/blob/vr_14246/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L837",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>) — 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>) — | |
| Whether to return a <code>~models.autoencoder_kl.AutoencoderKLOutput</code> instead of a plain tuple.`,name:"return_dict"}],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> | |
| `}),a(2),r(d);var l=e(d,2),k=t(l);o(k,{name:"enable_tiling",anchor:"diffusers.AutoencoderKLMagvit.enable_tiling",source:"https://github.com/huggingface/diffusers/blob/vr_14246/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L771",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>) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| 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"}]}),a(2),r(l);var v=e(l,2),O=t(v);o(O,{name:"forward",anchor:"diffusers.AutoencoderKLMagvit.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14246/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L1046",parameters:[{name:"sample",val:": Tensor"},{name:"sample_posterior",val:": bool = False"},{name:"return_dict",val:": bool = True"},{name:"generator",val:": typing.Optional[torch.Generator] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMagvit.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) — 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>) — | |
| 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>) — | |
| 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>) — | |
| 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"}],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> | |
| `}),r(v),r(s);var b=e(s,2);n(b,{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"});var c=e(b,2),E=t(c);o(E,{name:"class diffusers.models.modeling_outputs.AutoencoderKLOutput",anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14246/src/diffusers/models/modeling_outputs.py#L7",parameters:[{name:"latent_dist",val:": DiagonalGaussianDistribution"}],parametersDescription:[{anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput.latent_dist",description:`<strong>latent_dist</strong> (<code>DiagonalGaussianDistribution</code>) — | |
| 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"}]}),a(2),r(c);var M=e(c,2);n(M,{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"});var u=e(M,2),N=t(u);o(N,{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14246/src/diffusers/models/autoencoders/vae.py#L46",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>) — | |
| The decoded output sample from the last layer of the model.`,name:"sample"}]}),a(2),r(u);var j=e(u,2);W(j,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_magvit.md"}),a(2),A(x,p),V()}export{X as component}; | |
Xet Storage Details
- Size:
- 12.8 kB
- Xet hash:
- ae95c63df5c621647da0c3034caffed645ece1359d2e7b7baac3a384d9c13a1a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.