Buckets:
| import"../chunks/DsnmJJEf.js";import{i as A,h as K,C as z,H as v,a as N,D as o,E as D,s as I}from"../chunks/BtE7mKSK.js";import{p as U,o as E,s as e,f as C,a as b,b as j,c as t,d as M,n,r as a}from"../chunks/jDjavuwI.js";const V='{"title":"AutoencoderKLMiniMaxH3","local":"autoencoderklminimaxh3","sections":[{"title":"AutoencoderKLMiniMaxH3","local":"diffusers.AutoencoderKLMiniMaxH3","sections":[],"depth":2}],"depth":1}';var O=M('<meta name="hf:doc:metadata"/>'),S=M(`<p></p> <!> <!> <p>The video variational autoencoder (VAE) model with KL loss used in <a href="https://huggingface.co/MiniMaxAI/MiniMax-H3" rel="nofollow">MiniMax-H3</a> by MiniMax. It pairs a causal 3D CNN encoder with a non-causal ViT decoder and compresses 16x spatially and 4x temporally.</p> <p>Three things set it apart from most autoencoders in the library:</p> <ul><li><strong>Latents are normalized per channel.</strong> There is no <code>scaling_factor</code>: a pipeline encodes with <code>(latent - latents_mean) / latents_std</code> and decodes with <code>latent * latents_std + latents_mean</code>.</li> <li><strong>The pixel convention is ImageNet-normalized RGB over a <code>[0, 1]</code> base range</strong>, not the usual <code>[-1, 1]</code>. <code>encode</code> expects <code>(pixel - imagenet_mean) / imagenet_std</code> and <code>decode</code> returns values in that same space, so a pipeline applies <code>sample * imagenet_std + imagenet_mean</code> and clamps to <code>[0, 1]</code> before postprocessing.</li> <li><strong>Spatial tiling is on by default.</strong> MiniMax-H3 was released with tiling enabled for both encoding and decoding and the released frames are the blended-tile ones, so turning it off changes the output. Use <code>enable_tiling</code> to change the tile geometry and <code>disable_tiling</code> to switch it off.</li></ul> <p>The temporal geometry is fixed by <code>clip_length</code> (17 pixel frames per encoder chunk) and <code>token_drop</code> (3 trailing latent frames dropped per encode), so <code>17 * n + 5</code> pixel frames map to <code>5 * n + 2</code> latent frames.</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 a causal 3D CNN encoder and a non-causal ViT decoder, used in <a href="https://huggingface.co/MiniMaxAI" rel="nofollow">MiniMax-H3</a>.</p> <p>This model inherits from <a href="/docs/diffusers/pr_14409/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> <p>Latents are normalized with per-channel <code>latents_mean</code> / <code>latents_std</code> rather than a <code>scaling_factor</code>; a pipeline | |
| encodes with <code>(latent - latents_mean) / latents_std</code> and decodes with <code>latent * latents_std + latents_mean</code>.</p> <p>The pixel convention is ImageNet-normalized RGB over a <code>[0, 1]</code> base range, not the usual <code>[-1, 1]</code>: <code>encode</code> expects <code>(pixel - imagenet_mean) / imagenet_std</code> and <code>decode</code> returns values in that same space, so a pipeline has | |
| to apply <code>sample * imagenet_std + imagenet_mean</code> (mean <code>(0.485, 0.456, 0.406)</code>, std <code>(0.229, 0.224, 0.225)</code>) and | |
| clamp to <code>[0, 1]</code> before postprocessing.</p> <p>The temporal geometry is fixed by <code>clip_length</code> (17 pixel frames per encoder chunk) and <code>token_drop</code> (3 trailing | |
| latent frames dropped per encode): <code>17 * n + 5</code> pixel frames map to <code>5 * n + 2</code> latent frames.</p> <p>Unlike most autoencoders in the library, spatial tiling is <strong>on by default</strong>: MiniMax-H3 was released with tiling | |
| enabled for both encoding and decoding, and the released frames are the blended-tile ones, so disabling tiling | |
| changes the output. Use <code>enable_tiling</code> to change the tile geometry, <code>disable_tiling</code> to turn it off.</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>Encode a batch of videos 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>Decode a batch of latent videos.</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 encoding/decoding. When this option is enabled, the VAE splits the frames into tiles, encodes | |
| or decodes each tile separately and linearly blends the overlaps back together. This lowers the memory | |
| requirement and allows processing larger frames.</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 then decode a batch of videos.</p></div></div> <!> <p></p>`,1);function W(x,w){U(w,!1),E(()=>{new URLSearchParams(window.location.search).get("fw")}),A();var c=S();K("wczjst",f=>{var g=O();I(g,"content",V),b(f,g)});var l=e(C(c),2);z(l,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var p=e(l,2);v(p,{title:"AutoencoderKLMiniMaxH3",local:"autoencoderklminimaxh3",headingTag:"h1"});var m=e(p,10);N(m,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTE1pbmlNYXhIMyUwQSUwQXZhZSUyMCUzRCUyMEF1dG9lbmNvZGVyS0xNaW5pTWF4SDMuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMk1pbmlNYXhBSSUyRk1pbmlNYXgtSDMlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ2YWUlMjIlMkMlMjBkdHlwZSUzRHRvcmNoLmZsb2F0MzIlMEEpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLMiniMaxH3 | |
| vae = AutoencoderKLMiniMaxH3.from_pretrained( | |
| <span class="hljs-string">"MiniMaxAI/MiniMax-H3"</span>, subfolder=<span class="hljs-string">"vae"</span>, dtype=torch.float32 | |
| ).to(<span class="hljs-string">"cuda"</span>)`,lang:"python",wrap:!1});var u=e(m,2);v(u,{title:"AutoencoderKLMiniMaxH3",local:"diffusers.AutoencoderKLMiniMaxH3",headingTag:"h2"});var i=e(u,2),h=t(i);o(h,{name:"class diffusers.AutoencoderKLMiniMaxH3",anchor:"diffusers.AutoencoderKLMiniMaxH3",source:"https://github.com/huggingface/diffusers/blob/vr_14409/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3.py#L501",parameters:[{name:"in_channels",val:": int = 3"},{name:"out_channels",val:": int = 3"},{name:"latent_channels",val:": int = 24"},{name:"block_out_channels",val:": tuple = (128, 256, 256, 512, 512, 1024)"},{name:"layers_per_block",val:": int = 2"},{name:"spatial_downsample_factors",val:": tuple = (2, 2, 2, 2, 1, 1)"},{name:"temporal_downsample_factors",val:": tuple = (1, 2, 2, 1, 1, 1)"},{name:"norm_num_groups",val:": int = 32"},{name:"norm_eps",val:": float = 1e-06"},{name:"spatial_padding_mode",val:": str = 'reflect'"},{name:"decoder_num_layers",val:": int = 36"},{name:"decoder_num_attention_heads",val:": int = 32"},{name:"decoder_attention_head_dim",val:": int = 64"},{name:"decoder_num_register_tokens",val:": int = 4"},{name:"decoder_ffn_mult",val:": int = 4"},{name:"decoder_rope_theta",val:": float = 100.0"},{name:"decoder_rope_dim_ratio",val:": float = 0.75"},{name:"decoder_norm_eps",val:": float = 1e-05"},{name:"clip_length",val:": int = 17"},{name:"token_drop",val:": int = 3"},{name:"latents_mean",val:": tuple = (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)"},{name:"latents_std",val:": tuple = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)"}]});var r=e(h,14),y=t(r);o(y,{name:"encode",anchor:"diffusers.AutoencoderKLMiniMaxH3.encode",source:"https://github.com/huggingface/diffusers/blob/vr_14409/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3.py#L844",parameters:[{name:"x",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMiniMaxH3.encode.x",description:`<strong>x</strong> (<code>torch.Tensor</code>) — | |
| Input batch of videos, shape <code>(batch_size, in_channels, num_frames, height, width)</code>.`,name:"x"},{anchor:"diffusers.AutoencoderKLMiniMaxH3.encode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to return a <a href="/docs/diffusers/pr_14409/en/api/models/asymmetricautoencoderkl#diffusers.models.modeling_outputs.AutoencoderKLOutput">AutoencoderKLOutput</a> instead of a plain | |
| tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>The latent distribution of the encoded videos. Note that MiniMax-H3 normalizes the sampled latents with | |
| <code>latents_mean</code> / <code>latents_std</code> afterwards.</p> | |
| `}),n(2),a(r);var d=e(r,2),L=t(d);o(L,{name:"decode",anchor:"diffusers.AutoencoderKLMiniMaxH3.decode",source:"https://github.com/huggingface/diffusers/blob/vr_14409/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3.py#L869",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMiniMaxH3.decode.z",description:`<strong>z</strong> (<code>torch.Tensor</code>) — | |
| Input batch of latent videos, shape <code>(batch_size, latent_channels, num_latent_frames, height, width)</code>.`,name:"z"},{anchor:"diffusers.AutoencoderKLMiniMaxH3.decode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to return a <a href="/docs/diffusers/pr_14409/en/api/models/asymmetricautoencoderkl#diffusers.models.autoencoders.vae.DecoderOutput">DecoderOutput</a> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>The decoded videos, shape <code>(batch_size, out_channels, num_frames, height, width)</code>.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/diffusers/pr_14409/en/api/models/asymmetricautoencoderkl#diffusers.models.autoencoders.vae.DecoderOutput" | |
| >DecoderOutput</a> or <code>tuple</code></p> | |
| `}),n(2),a(d);var s=e(d,2),T=t(s);o(T,{name:"enable_tiling",anchor:"diffusers.AutoencoderKLMiniMaxH3.enable_tiling",source:"https://github.com/huggingface/diffusers/blob/vr_14409/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3.py#L617",parameters:[{name:"tile_sample_min_height",val:": int | None = None"},{name:"tile_sample_min_width",val:": int | None = None"},{name:"tile_sample_min_overlap_height",val:": int | None = None"},{name:"tile_sample_min_overlap_width",val:": int | None = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMiniMaxH3.enable_tiling.tile_sample_min_height",description:`<strong>tile_sample_min_height</strong> (<code>int</code>, <em>optional</em>) — | |
| The tile height in pixel space. Frames taller than this are split along the height dimension.`,name:"tile_sample_min_height"},{anchor:"diffusers.AutoencoderKLMiniMaxH3.enable_tiling.tile_sample_min_width",description:`<strong>tile_sample_min_width</strong> (<code>int</code>, <em>optional</em>) — | |
| The tile width in pixel space. Frames wider than this are split along the width dimension.`,name:"tile_sample_min_width"},{anchor:"diffusers.AutoencoderKLMiniMaxH3.enable_tiling.tile_sample_min_overlap_height",description:`<strong>tile_sample_min_overlap_height</strong> (<code>int</code>, <em>optional</em>) — | |
| The minimum overlap, in pixels, between two consecutive vertical tiles.`,name:"tile_sample_min_overlap_height"},{anchor:"diffusers.AutoencoderKLMiniMaxH3.enable_tiling.tile_sample_min_overlap_width",description:`<strong>tile_sample_min_overlap_width</strong> (<code>int</code>, <em>optional</em>) — | |
| The minimum overlap, in pixels, between two consecutive horizontal tiles.`,name:"tile_sample_min_overlap_width"}]}),n(2),a(s);var _=e(s,2),k=t(_);o(k,{name:"forward",anchor:"diffusers.AutoencoderKLMiniMaxH3.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14409/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3.py#L892",parameters:[{name:"sample",val:": Tensor"},{name:"sample_posterior",val:": bool = False"},{name:"generator",val:": typing.Optional[torch.Generator] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMiniMaxH3.forward.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) — | |
| Input batch of videos, shape <code>(batch_size, in_channels, num_frames, height, width)</code>.`,name:"sample"},{anchor:"diffusers.AutoencoderKLMiniMaxH3.forward.sample_posterior",description:`<strong>sample_posterior</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to sample the posterior instead of taking its mode.`,name:"sample_posterior"},{anchor:"diffusers.AutoencoderKLMiniMaxH3.forward.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) — | |
| Generator used when <code>sample_posterior=True</code>.`,name:"generator"},{anchor:"diffusers.AutoencoderKLMiniMaxH3.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to return a <a href="/docs/diffusers/pr_14409/en/api/models/asymmetricautoencoderkl#diffusers.models.autoencoders.vae.DecoderOutput">DecoderOutput</a> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>The round-tripped videos, shape <code>(batch_size, out_channels, num_frames, height, width)</code>.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/diffusers/pr_14409/en/api/models/asymmetricautoencoderkl#diffusers.models.autoencoders.vae.DecoderOutput" | |
| >DecoderOutput</a> or <code>tuple</code></p> | |
| `}),n(2),a(_),a(i);var H=e(i,2);D(H,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_minimax_h3.md"}),n(2),b(x,c),j()}export{W as component}; | |
Xet Storage Details
- Size:
- 14.4 kB
- Xet hash:
- e5cc3f84327c1efa9476012470eda0d41e8f974657e4f221aaadc5ecdaad7560
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.