mstar.model.voxcpm2.components.audio_vae#
AudioVAE V2 of VoxCPM2: 16 kHz waveform -> 25 Hz latents -> 48 kHz waveform.
A port of the reference AudioVAEV2 (a DAC-style causal conv VAE with an
asymmetric decoder and sample-rate conditioning). Every convolution pads on
the left only and every transposed convolution trims on the right, so a latent
frame’s audio depends on a bounded span of earlier frames:
decoder_receptive_field_frames() derives that span from the modules,
which is how much left context a streamed window needs to reproduce a whole
decode.
Weight norm is folded into plain weights at load (fold_weight_norm); the
checkpoint’s weight_g / weight_v pairs are combined once, in fp32.
Functions
|
Latent frames of left context a frame's audio needs to equal a whole decode. |
|
|
Classes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- class mstar.model.voxcpm2.components.audio_vae.AudioVAE(config)[source]#
Bases:
Moduleencode:[B, samples@16k]->[B, 64, frames];decode:[B, 64, frames]->[B, frames * 1920]at 48 kHz.- Parameters:
config (AudioVAEConfig)
- class mstar.model.voxcpm2.components.audio_vae.CausalConv1d(*args, padding=0, output_padding=0, **kwargs)[source]#
Bases:
Conv1d- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class mstar.model.voxcpm2.components.audio_vae.CausalDecoder(config)[source]#
Bases:
Module- Parameters:
config (AudioVAEConfig)
- forward(z, sr_index)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class mstar.model.voxcpm2.components.audio_vae.CausalDecoderBlock(input_dim, output_dim, stride, groups=1)[source]#
Bases:
Module- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class mstar.model.voxcpm2.components.audio_vae.CausalEncoder(d_model, latent_dim, strides, depthwise)[source]#
Bases:
Module- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class mstar.model.voxcpm2.components.audio_vae.CausalEncoderBlock(output_dim, stride, groups=1)[source]#
Bases:
Module- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class mstar.model.voxcpm2.components.audio_vae.CausalResidualUnit(dim, dilation=1, kernel=7, groups=1)[source]#
Bases:
Module- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class mstar.model.voxcpm2.components.audio_vae.CausalTransposeConv1d(*args, padding=0, output_padding=0, **kwargs)[source]#
Bases:
ConvTranspose1d- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class mstar.model.voxcpm2.components.audio_vae.SampleRateCondition(input_dim, buckets)[source]#
Bases:
Modulescale_biasconditioning: a per-channel affine picked by output-rate bucket.- forward(x, sr_index)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class mstar.model.voxcpm2.components.audio_vae.Snake1d(channels)[source]#
Bases:
Module- Parameters:
channels (int)
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- mstar.model.voxcpm2.components.audio_vae.decoder_receptive_field_frames(decoder)[source]#
Latent frames of left context a frame’s audio needs to equal a whole decode.
Walks the decoder backwards from a frame’s first output sample; exact for the modules modelled in
_earliest_input(20 frames for VoxCPM2). The sample-rate conditioning is per channel, so it adds nothing.- Parameters:
decoder (CausalDecoder)
- Return type: