Buckets:
| import"../chunks/DsnmJJEf.js";import{i as H,h as k,C as K,H as M,a as J,D as o,E as D,s as N}from"../chunks/DBNuz8hP.js";import{p as U,o as z,s as e,f as q,a as v,b as j,c as a,d as b,n,r as t}from"../chunks/CQ2f15a1.js";const E='{"title":"AutoencoderKLMiniMaxH3Image","local":"autoencoderklminimaxh3image","sections":[{"title":"AutoencoderKLMiniMaxH3Image","local":"diffusers.AutoencoderKLMiniMaxH3Image","sections":[],"depth":2}],"depth":1}';var V=b('<meta name="hf:doc:metadata"/>'),W=b(`<p></p> <!> <!> <p>The image variational autoencoder (VAE) model with KL loss used in <a href="https://huggingface.co/MiniMaxAI/MiniMax-H3-Image" rel="nofollow">MiniMax-H3-Image</a> by MiniMax. It pairs the causal 3D CNN encoder of <a href="/docs/diffusers/pr_15249/en/api/models/autoencoderkl_minimax_h3#diffusers.AutoencoderKLMiniMaxH3">AutoencoderKLMiniMaxH3</a>, run over a single frame, with a 2D ViT decoder, and compresses 16x spatially. <code>encode</code> and <code>decode</code> take and return 4D image tensors.</p> <p>It shares three conventions with <a href="/docs/diffusers/pr_15249/en/api/models/autoencoderkl_minimax_h3#diffusers.AutoencoderKLMiniMaxH3">AutoencoderKLMiniMaxH3</a>:</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-Image was released with tiling enabled for both encoding and decoding and the released images 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> <!> <!> <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 2D ViT decoder, used in <a href="https://huggingface.co/MiniMaxAI" rel="nofollow">MiniMax-H3-Image</a>. The encoder is the MiniMax-H3 video encoder run over a single | |
| frame; the decoder is an image-only ViT.</p> <p>This model inherits from <a href="/docs/diffusers/pr_15249/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>Unlike most autoencoders in the library, spatial tiling is <strong>on by default</strong>: MiniMax-H3-Image was released with | |
| tiling enabled for both encoding and decoding, and the released images 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 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>Decode a batch of 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 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 images.</p></div></div> <!> <p></p>`,1);function Y(x,w){U(w,!1),z(()=>{new URLSearchParams(window.location.search).get("fw")}),H();var l=W();k("1cb92cj",_=>{var f=V();N(f,"content",E),v(_,f)});var c=e(q(l),2);K(c,{containerStyle:"float: inline-end; margin-inline-start: 10px; display: inline-flex; position: relative; z-index: 10;"});var m=e(c,2);M(m,{title:"AutoencoderKLMiniMaxH3Image",local:"autoencoderklminimaxh3image",headingTag:"h1"});var p=e(m,8);J(p,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTE1pbmlNYXhIM0ltYWdlJTBBJTBBdmFlJTIwJTNEJTIwQXV0b2VuY29kZXJLTE1pbmlNYXhIM0ltYWdlLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJNaW5pTWF4QUklMkZNaW5pTWF4LUgzLUltYWdlJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydmFlX2RpZmZ1c2VycyUyMiUyQyUyMGR0eXBlJTNEdG9yY2guZmxvYXQzMiUwQSkudG8oJTIyY3VkYSUyMiklMjAlMjAlMjMlMjBvciUyMCUyMm1wcyUyMiUyQyUyMCUyMnhwdSUyMiUyQyUyMCUyMmNwdSUyMg==",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLMiniMaxH3Image | |
| vae = AutoencoderKLMiniMaxH3Image.from_pretrained( | |
| <span class="hljs-string">"MiniMaxAI/MiniMax-H3-Image"</span>, subfolder=<span class="hljs-string">"vae_diffusers"</span>, dtype=torch.float32 | |
| ).to(<span class="hljs-string">"cuda"</span>) <span class="hljs-comment"># or "mps", "xpu", "cpu"</span>`,lang:"python",wrap:!1});var u=e(p,2);M(u,{title:"AutoencoderKLMiniMaxH3Image",local:"diffusers.AutoencoderKLMiniMaxH3Image",headingTag:"h2"});var i=e(u,2),h=a(i);o(h,{name:"class diffusers.AutoencoderKLMiniMaxH3Image",anchor:"diffusers.AutoencoderKLMiniMaxH3Image",source:"https://github.com/huggingface/diffusers/blob/vr_15249/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3_image.py#L499",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[int, ...] = (128, 256, 256, 512, 512, 1024)"},{name:"layers_per_block",val:": int = 2"},{name:"spatial_downsample_factors",val:": tuple[int, ...] = (2, 2, 2, 2, 1, 1)"},{name:"temporal_downsample_factors",val:": tuple[int, ...] = (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 = 24"},{name:"decoder_num_attention_heads",val:": int = 16"},{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.5"},{name:"decoder_norm_eps",val:": float = 1e-05"},{name:"latents_mean",val:": tuple[float, ...] = (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[float, ...] = (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,12),y=a(r);o(y,{name:"encode",anchor:"diffusers.AutoencoderKLMiniMaxH3Image.encode",source:"https://github.com/huggingface/diffusers/blob/vr_15249/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3_image.py#L758",parameters:[{name:"x",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMiniMaxH3Image.encode.x",description:`<strong>x</strong> (<code>torch.Tensor</code>) — | |
| Input batch of images, shape <code>(batch_size, in_channels, height, width)</code>.`,name:"x"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Image.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_15249/en/api/models/autoencoderkl_qwenimage#diffusers.models.modeling_outputs.AutoencoderKLOutput">AutoencoderKLOutput</a> instead of a plain | |
| tuple.`,name:"return_dict"}],returnDescription:` | |
| <p>The latent distribution of the encoded images, over latents of shape <code>(batch_size, latent_channels, height // spatial_compression_ratio, width // spatial_compression_ratio)</code>. Note that MiniMax-H3-Image normalizes | |
| the sampled latents with <code>latents_mean</code> / <code>latents_std</code> afterwards.</p> | |
| `}),n(2),t(r);var s=e(r,2),I=a(s);o(I,{name:"decode",anchor:"diffusers.AutoencoderKLMiniMaxH3Image.decode",source:"https://github.com/huggingface/diffusers/blob/vr_15249/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3_image.py#L786",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMiniMaxH3Image.decode.z",description:`<strong>z</strong> (<code>torch.Tensor</code>) — | |
| Input batch of latents, shape <code>(batch_size, latent_channels, height, width)</code>.`,name:"z"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Image.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_15249/en/api/models/autoencoderkl_qwenimage#diffusers.models.autoencoders.vae.DecoderOutput">DecoderOutput</a> instead of a plain tuple.`,name:"return_dict"}],returnDescription:` | |
| <p>The decoded images, shape <code>(batch_size, out_channels, height * spatial_compression_ratio, width * spatial_compression_ratio)</code>.</p> | |
| `,returnType:` | |
| <p><a | |
| href="/docs/diffusers/pr_15249/en/api/models/autoencoderkl_qwenimage#diffusers.models.autoencoders.vae.DecoderOutput" | |
| >DecoderOutput</a> or <code>tuple</code></p> | |
| `}),n(2),t(s);var d=e(s,2),T=a(d);o(T,{name:"enable_tiling",anchor:"diffusers.AutoencoderKLMiniMaxH3Image.enable_tiling",source:"https://github.com/huggingface/diffusers/blob/vr_15249/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3_image.py#L608",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.AutoencoderKLMiniMaxH3Image.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.AutoencoderKLMiniMaxH3Image.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.AutoencoderKLMiniMaxH3Image.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.AutoencoderKLMiniMaxH3Image.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),t(d);var g=e(d,2),L=a(g);o(L,{name:"forward",anchor:"diffusers.AutoencoderKLMiniMaxH3Image.forward",source:"https://github.com/huggingface/diffusers/blob/vr_15249/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3_image.py#L812",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.AutoencoderKLMiniMaxH3Image.forward.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) — | |
| Input batch of images, shape <code>(batch_size, in_channels, height, width)</code>.`,name:"sample"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Image.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.AutoencoderKLMiniMaxH3Image.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.AutoencoderKLMiniMaxH3Image.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_15249/en/api/models/autoencoderkl_qwenimage#diffusers.models.autoencoders.vae.DecoderOutput">DecoderOutput</a> instead of a plain tuple.`,name:"return_dict"}],returnDescription:` | |
| <p>The round-tripped images, shape <code>(batch_size, out_channels, height, width)</code>.</p> | |
| `,returnType:` | |
| <p><a | |
| href="/docs/diffusers/pr_15249/en/api/models/autoencoderkl_qwenimage#diffusers.models.autoencoders.vae.DecoderOutput" | |
| >DecoderOutput</a> or <code>tuple</code></p> | |
| `}),n(2),t(g),t(i);var A=e(i,2);D(A,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_minimax_h3_image.md"}),n(2),v(x,l),j()}export{Y as component}; | |
Xet Storage Details
- Size:
- 14.5 kB
- Xet hash:
- 43450459c86867da863921fcc3b6c914b600468a88271306d4e809a45db316bd
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.