#
AutoencoderOobleck

The Oobleck variational autoencoder (VAE) model with KL loss was introduced in Stability-AI/stable-audio-tools and Stable Audio Open by Stability AI. The model is used in 🤗 Diffusers to encode audio waveforms into latents and to decode latent representations into audio waveforms.

The abstract from the paper is:

Open generative models are vitally important for the community, allowing for fine-tunes and serving as baselines when presenting new models. However, most current text-to-audio models are private and not accessible for artists and researchers to build upon. Here we describe the architecture and training process of a new open-weights text-to-audio model trained with Creative Commons data. Our evaluation shows that the model’s performance is competitive with the state-of-the-art across various metrics. Notably, the reported FDopenl3 results (measuring the realism of the generations) showcase its potential for high-quality stereo sound synthesis at 44.1kHz.

##
AutoencoderOobleck

###
class diffusers.AutoencoderOobleck

< source >

( encoder_hidden_size = 128 downsampling_ratios = [2, 4, 4, 8, 8] channel_multiples = [1, 2, 4, 8, 16] decoder_channels = 128 decoder_input_channels = 64 audio_channels = 2 sampling_rate = 44100 )

Parameters

- encoder_hidden_size (`int`, optional, defaults to 128) — Intermediate representation dimension for the encoder.
- downsampling_ratios (`List[int]`, optional, defaults to `[2, 4, 4, 8, 8]`) — Ratios for downsampling in the encoder. These are used in reverse order for upsampling in the decoder.
- channel_multiples (`List[int]`, optional, defaults to `[1, 2, 4, 8, 16]`) — Multiples used to determine the hidden sizes of the hidden layers.
- decoder_channels (`int`, optional, defaults to 128) — Intermediate representation dimension for the decoder.
- decoder_input_channels (`int`, optional, defaults to 64) — Input dimension for the decoder. Corresponds to the latent dimension.
- audio_channels (`int`, optional, defaults to 2) — Number of channels in the audio data. Either 1 for mono or 2 for stereo.
- sampling_rate (`int`, optional, defaults to 44100) — The sampling rate at which the audio waveform should be digitalized expressed in hertz (Hz).

An autoencoder for encoding waveforms into latents and decoding latent representations into waveforms. First introduced in Stable Audio.

This model inherits from ModelMixin. Check the superclass documentation for it’s generic methods implemented for all models (such as downloading or saving).

####
wrapper

< source >

( *args **kwargs )

####
wrapper

< source >

( *args **kwargs )

####
disable_slicing

< source >

( )

Disable sliced VAE decoding. If `enable_slicing` was previously enabled, this method will go back to computing decoding in one step.

####
enable_slicing

< source >

( )

Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to compute decoding in several steps. This is useful to save some memory and allow larger batch sizes.

####
forward

< source >

( sample: Tensor sample_posterior: bool = False return_dict: bool = True generator: typing.Optional[torch._C.Generator] = None )

Parameters

- sample (`torch.Tensor`) — Input sample.
- sample_posterior (`bool`, optional, defaults to `False`) — Whether to sample from the posterior.
- return_dict (`bool`, optional, defaults to `True`) — Whether or not to return a `OobleckDecoderOutput` instead of a plain tuple.

##
OobleckDecoderOutput

###
class diffusers.models.autoencoders.autoencoder_oobleck.OobleckDecoderOutput

< source >

( sample: Tensor )

Parameters

- sample (`torch.Tensor` of shape `(batch_size, audio_channels, sequence_length)`) — The decoded output sample from the last layer of the model.

Output of decoding method.

##
OobleckDecoderOutput

###
class diffusers.models.autoencoders.autoencoder_oobleck.OobleckDecoderOutput

< source >

( sample: Tensor )

Parameters

- sample (`torch.Tensor` of shape `(batch_size, audio_channels, sequence_length)`) — The decoded output sample from the last layer of the model.

Output of decoding method.

##
AutoencoderOobleckOutput

###
class diffusers.models.autoencoders.autoencoder_oobleck.AutoencoderOobleckOutput

< source >

( latent_dist: OobleckDiagonalGaussianDistribution )

Parameters

- latent_dist (`OobleckDiagonalGaussianDistribution`) — Encoded outputs of `Encoder` represented as the mean and standard deviation of `OobleckDiagonalGaussianDistribution`. `OobleckDiagonalGaussianDistribution` allows for sampling latents from the distribution.

Output of AutoencoderOobleck encoding method.

< > Update on GitHub