Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions docs/source/en/api/models/autoencoder_kl_kvae_audio.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ limitations under the License. -->
# AutoencoderKLKVAEAudio

A 1D convolutional variational autoencoder (VAE) with KL loss for audio, introduced by the Kandinsky Lab
Team in [KVAE-Audio](https://huggingface.co/kandinskylab/KVAE-Audio). It compresses raw, full-band (48 kHz)
waveforms into compact continuous latents and reconstructs them with high fidelity across speech, music, and
general audio.
Team. [KVAE-Audio](https://huggingface.co/kandinskylab/KVAE-Audio) is the mono model and has 64 latent channels.
[KVAE-Audio-Stereo](https://huggingface.co/kandinskylab/KVAE-Audio-Stereo) is the stereo model and has 128 latent
channels. Both compress raw, full-band (48 kHz) waveforms into compact continuous latents and reconstruct them
with high fidelity across speech, music, and general audio.

The model can be loaded with the following code snippet.

```python
import torch
from diffusers import AutoencoderKLKVAEAudio

vae = AutoencoderKLKVAEAudio.from_pretrained("kandinskylab/KVAE-Audio", subfolder="diffusers", dtype=torch.float32)
vae = AutoencoderKLKVAEAudio.from_pretrained(
"kandinskylab/KVAE-Audio-Stereo", # or kandinskylab/KVAE-Audio
subfolder="diffusers",
dtype=torch.float32,
)
```

## AutoencoderKLKVAEAudio
Expand Down
4 changes: 2 additions & 2 deletions scripts/convert_kvae_audio_to_diffusers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# --output_path /path/to/output

"""
Converts a `kandinskylab/KVAE-Audio` checkpoint (the `kvae.models.kvae_1d.KVAEAudio` architecture) into an
`AutoencoderKLKVAEAudio`.
Converts a `kandinskylab/KVAE-Audio` or `kandinskylab/KVAE-Audio-Stereo` checkpoint (the
`kvae.models.kvae_1d.KVAEAudio` architecture) into an `AutoencoderKLKVAEAudio`.

Key mapping, `encoder`/`decoder` (reference `Encoder1D`/`Decoder1D` -> `KVAEAudioEncoder`/`KVAEAudioDecoder`):
{enc,dec}.model.0 -> {encoder,decoder}.conv1 (stem conv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
class AutoencoderKLKVAEAudio(ModelMixin, AttentionMixin, AutoencoderMixin, ConfigMixin):
r"""
A 1D convolutional autoencoder for encoding raw audio waveforms into continuous latents and decoding them back into
waveforms. Introduced in [KVAE-Audio](https://huggingface.co/kandinskylab/KVAE-Audio).
waveforms. [KVAE-Audio](https://huggingface.co/kandinskylab/KVAE-Audio) is the mono checkpoint and has 64 latent
channels. [KVAE-Audio-Stereo](https://huggingface.co/kandinskylab/KVAE-Audio-Stereo) is the stereo checkpoint and
has 128 latent channels.

This model inherits from [`ModelMixin`]. Check the superclass documentation for it's generic methods implemented
for all models (such as downloading or saving).
Expand All @@ -270,7 +272,7 @@ class AutoencoderKLKVAEAudio(ModelMixin, AttentionMixin, AutoencoderMixin, Confi
sample_rate (`int`, *optional*, defaults to 48000):
The sampling rate, in Hz, that the model was trained on.
num_channels (`int`, *optional*, defaults to 1):
Number of channels in the audio data (1 for mono).
Number of channels in the audio data (1 for mono, 2 for stereo).
attn_num_heads (`int`, *optional*, defaults to 8):
Number of heads in the self-attention block applied to the encoder output.
"""
Expand Down