Buckets:

download
raw
14 kB
import"../chunks/DsnmJJEf.js";import{i as H,h as L,C as y,H as g,a as K,D as o,E as z,s as J}from"../chunks/CmJXCtRL.js";import{p as D,o as j,s as e,f as W,a as M,b as I,c as t,d as x,n,r as a}from"../chunks/DK803DsY.js";const N='{"title":"AutoencoderKLMiniMaxH3Audio","local":"autoencoderklminimaxh3audio","sections":[{"title":"AutoencoderKLMiniMaxH3Audio","local":"diffusers.AutoencoderKLMiniMaxH3Audio","sections":[],"depth":2}],"depth":1}';var G=x('<meta name="hf:doc:metadata"/>'),E=x(`<p></p> <!> <!> <p>The audio autoencoder used in <a href="https://huggingface.co/MiniMaxAI" rel="nofollow">MiniMax-H3</a> by MiniMax. It is waveform in and waveform out, with no mel front-end and no separate vocoder: a DAC-lineage strided convolutional encoder, a causal-attention projection onto the diffusion latent width, and a BigVGAN decoder.</p> <p>The encoder hops 800 samples at 32 kHz, i.e. 40 latents per second, so a waveform of <code>800 * n</code> samples encodes to <code>n</code> latents. Waveforms that are not a whole number of hops are right-padded.</p> <p>The causal-attention projection goes through the attention dispatcher, so <code>set_attention_backend</code> applies to it; its mask is <code>is_causal=True</code>, which every backend honours except <code>_native_npu</code>, whose kernel takes no causal flag.</p> <p>The autoencoder is <strong>mono</strong>, and it normalizes latents per channel with <code>latents_mean</code> / <code>latents_std</code> rather than a scalar <code>scaling_factor</code>. MiniMax-H3 carries stereo as two <em>batch</em> items, and it always consumes the posterior mean (<code>latent_dist.mode()</code>), never a sample.</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>The audio autoencoder used by <a href="https://huggingface.co/MiniMaxAI" rel="nofollow">MiniMax-H3</a>: a DAC-lineage convolutional encoder
and a BigVGAN decoder, operating directly on mono 32 kHz waveforms.</p> <p>This model inherits from <a href="/docs/diffusers/pr_14407/en/api/models/overview#diffusers.ModelMixin">ModelMixin</a>. Check the superclass documentation for the generic methods the library
implements 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>Encode a waveform into the audio latent posterior.</p> <p>The waveform is right-padded to a multiple of <code>hop_length</code> (800 samples) first. MiniMax-H3 always consumes the
posterior <strong>mean</strong> (<code>latent_dist.mode()</code>) — the <code>logs_proj</code> head is never evaluated by the reference pipeline.</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 audio latents into a waveform.</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 waveform.</p></div></div> <!> <p></p>`,1);function B(v,A){D(A,!1),j(()=>{new URLSearchParams(window.location.search).get("fw")}),H();var i=E();L("e5424c",h=>{var _=G();J(_,"content",N),M(h,_)});var c=e(W(i),2);y(c,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var l=e(c,2);g(l,{title:"AutoencoderKLMiniMaxH3Audio",local:"autoencoderklminimaxh3audio",headingTag:"h1"});var u=e(l,10);K(u,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTE1pbmlNYXhIM0F1ZGlvJTBBJTBBYXVkaW9fdmFlJTIwJTNEJTIwQXV0b2VuY29kZXJLTE1pbmlNYXhIM0F1ZGlvLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJNaW5pTWF4QUklMkZNaW5pTWF4LUgzJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIyYXVkaW9fdmFlJTIyJTJDJTIwZHR5cGUlM0R0b3JjaC5mbG9hdDMyJTBBKS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLMiniMaxH3Audio
audio_vae = AutoencoderKLMiniMaxH3Audio.from_pretrained(
<span class="hljs-string">&quot;MiniMaxAI/MiniMax-H3&quot;</span>, subfolder=<span class="hljs-string">&quot;audio_vae&quot;</span>, dtype=torch.float32
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,lang:"python",wrap:!1});var p=e(u,2);g(p,{title:"AutoencoderKLMiniMaxH3Audio",local:"diffusers.AutoencoderKLMiniMaxH3Audio",headingTag:"h2"});var r=e(p,2),m=t(r);o(m,{name:"class diffusers.AutoencoderKLMiniMaxH3Audio",anchor:"diffusers.AutoencoderKLMiniMaxH3Audio",source:"https://github.com/huggingface/diffusers/blob/vr_14407/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3_audio.py#L489",parameters:[{name:"encoder_dim",val:": int = 64"},{name:"encoder_rates",val:": tuple = (2, 4, 4, 5, 5)"},{name:"latent_dim",val:": int = 2048"},{name:"latent_channels",val:": int = 32"},{name:"num_attention_heads",val:": int = 8"},{name:"decoder_dim",val:": int = 1024"},{name:"decoder_rates",val:": tuple = (5, 5, 2, 2, 2, 2, 2)"},{name:"decoder_kernel_sizes",val:": tuple = (9, 9, 4, 4, 4, 4, 4)"},{name:"resblock_kernel_sizes",val:": tuple = (3, 7, 11)"},{name:"resblock_dilation_sizes",val:": tuple = ((1, 3, 5), (1, 3, 5), (1, 3, 5))"},{name:"sampling_rate",val:": int = 32000"},{name:"latents_mean",val:": list[float] | None = None"},{name:"latents_std",val:": list[float] | None = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.encoder_dim",description:`<strong>encoder_dim</strong> (<code>int</code>, defaults to <code>64</code>) &#x2014;
Channel width of the encoder&#x2019;s first convolution; doubles at every downsampling stage.`,name:"encoder_dim"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.encoder_rates",description:`<strong>encoder_rates</strong> (<code>tuple[int]</code>, defaults to <code>(2, 4, 4, 5, 5)</code>) &#x2014;
Encoder strides. Their product (<code>800</code>) is the hop length, i.e. 40 latents/s at 32 kHz.`,name:"encoder_rates"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.latent_dim",description:`<strong>latent_dim</strong> (<code>int</code>, defaults to <code>2048</code>) &#x2014;
Width of the encoder trunk and of the decoder input, before/after the latent projections.`,name:"latent_dim"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.latent_channels",description:`<strong>latent_channels</strong> (<code>int</code>, defaults to <code>32</code>) &#x2014;
Width of the diffusion latent, i.e. the <code>mean_proj</code> / <code>logs_proj</code> output channels.`,name:"latent_channels"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>8</code>) &#x2014;
Number of heads in the causal-attention projection <code>pre_block</code>.`,name:"num_attention_heads"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.decoder_dim",description:`<strong>decoder_dim</strong> (<code>int</code>, defaults to <code>1024</code>) &#x2014;
BigVGAN initial channel count; halved at every upsampling stage.`,name:"decoder_dim"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.decoder_rates",description:`<strong>decoder_rates</strong> (<code>tuple[int]</code>, defaults to <code>(5, 5, 2, 2, 2, 2, 2)</code>) &#x2014;
BigVGAN upsampling rates. Their product must equal <code>prod(encoder_rates)</code>.`,name:"decoder_rates"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.decoder_kernel_sizes",description:`<strong>decoder_kernel_sizes</strong> (<code>tuple[int]</code>, defaults to <code>(9, 9, 4, 4, 4, 4, 4)</code>) &#x2014;
Transposed-convolution kernel size per upsampling stage.`,name:"decoder_kernel_sizes"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.resblock_kernel_sizes",description:`<strong>resblock_kernel_sizes</strong> (<code>tuple[int]</code>, defaults to <code>(3, 7, 11)</code>) &#x2014;
Kernel sizes of the parallel AMP residual blocks at each upsampling stage.`,name:"resblock_kernel_sizes"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.resblock_dilation_sizes",description:`<strong>resblock_dilation_sizes</strong> (<code>tuple[tuple[int]]</code>, defaults to <code>((1, 3, 5), (1, 3, 5), (1, 3, 5))</code>) &#x2014;
Per-AMP-block dilations.`,name:"resblock_dilation_sizes"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.sampling_rate",description:`<strong>sampling_rate</strong> (<code>int</code>, defaults to <code>32000</code>) &#x2014;
Waveform sampling rate.`,name:"sampling_rate"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.latents_mean",description:`<strong>latents_mean</strong> (<code>list[float]</code>, <em>optional</em>) &#x2014;
Per-channel latent mean the pipeline uses to normalize / denormalize latents.`,name:"latents_mean"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.latents_std",description:`<strong>latents_std</strong> (<code>list[float]</code>, <em>optional</em>) &#x2014;
Per-channel latent standard deviation the pipeline uses to normalize / denormalize latents.`,name:"latents_std"}]});var d=e(m,6),b=t(d);o(b,{name:"encode",anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.encode",source:"https://github.com/huggingface/diffusers/blob/vr_14407/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3_audio.py#L579",parameters:[{name:"sample",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.encode.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
Mono waveform of shape <code>[batch_size, 1, samples]</code>. MiniMax-H3 passes the two stereo channels of a
reference clip as <code>batch_size = 2</code>.`,name:"sample"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.encode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to return a <code>MiniMaxH3AudioEncoderOutput</code> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>The latent posterior over <code>[batch_size, latent_channels, samples / 800]</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>MiniMaxH3AudioEncoderOutput</code> or <code>tuple</code></p>
`}),n(4),a(d);var s=e(d,2),T=t(s);o(T,{name:"decode",anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.decode",source:"https://github.com/huggingface/diffusers/blob/vr_14407/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3_audio.py#L619",parameters:[{name:"latents",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.decode.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>) &#x2014;
Denormalized latents of shape <code>[batch_size, latent_channels, num_frames]</code>. MiniMax-H3 passes the two
stereo channels as <code>batch_size = 2</code>.`,name:"latents"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.decode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to return a <a href="/docs/diffusers/pr_14407/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>Waveform of shape <code>[batch_size, 1, num_frames * 800]</code>, clamped to <code>[-1, 1]</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><a
href="/docs/diffusers/pr_14407/en/api/models/asymmetricautoencoderkl#diffusers.models.autoencoders.vae.DecoderOutput"
>DecoderOutput</a> or <code>tuple</code></p>
`}),n(2),a(s);var f=e(s,2),w=t(f);o(w,{name:"forward",anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14407/src/diffusers/models/autoencoders/autoencoder_kl_minimax_h3_audio.py#L649",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.AutoencoderKLMiniMaxH3Audio.forward.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
Mono waveform of shape <code>[batch_size, 1, samples]</code>.`,name:"sample"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.forward.sample_posterior",description:`<strong>sample_posterior</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to sample the posterior instead of taking its mode. MiniMax-H3 uses the mode.`,name:"sample_posterior"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to return a <a href="/docs/diffusers/pr_14407/en/api/models/asymmetricautoencoderkl#diffusers.models.autoencoders.vae.DecoderOutput">DecoderOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.AutoencoderKLMiniMaxH3Audio.forward.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
Generator used when <code>sample_posterior=True</code>.`,name:"generator"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>The round-tripped waveform of shape <code>[batch_size, 1, num_frames * 800]</code>, clamped to <code>[-1, 1]</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><a
href="/docs/diffusers/pr_14407/en/api/models/asymmetricautoencoderkl#diffusers.models.autoencoders.vae.DecoderOutput"
>DecoderOutput</a> or <code>tuple</code></p>
`}),n(2),a(f),a(r);var k=e(r,2);z(k,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_minimax_h3_audio.md"}),n(2),M(v,i),I()}export{B as component};

Xet Storage Details

Size:
14 kB
·
Xet hash:
bda3b92e77a976c071a17260e855a31fde35beca736ce82f0e467ca263ac31dc

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