# AutoencoderKLKVAEAudio

Kandinsky Lab Team tarafından [KVAE-Audio](https://huggingface.co/kandinskylab/KVAE-Audio) makalesinde tanıtılan, ses için KL kaybı kullanan 1B konvolüsyonel varyasyonel otoenkoder (VAE). Ham, tam bant (48 kHz) dalga formlarını kompakt sürekli latentlere sıkıştırır ve konuşma, müzik ve genel ses için yüksek sadakatle yeniden oluşturur.

Model, aşağıdaki kod parçasıyla yüklenebilir.

```python
import torch
from diffusers import AutoencoderKLKVAEAudio

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

## AutoencoderKLKVAEAudio[[diffusers.AutoencoderKLKVAEAudio]]

#### diffusers.AutoencoderKLKVAEAudio[[diffusers.AutoencoderKLKVAEAudio]]

```python
diffusers.AutoencoderKLKVAEAudio(encoder_dim: int = 64, encoder_rates: list = [2, 3, 4, 5, 8], latent_dim: int = 2048, codebook_dim: int = 64, decoder_dim: int = 1536, decoder_rates: list = [8, 5, 4, 3, 2], sample_rate: int = 48000, num_channels: int = 1, attn_num_heads: int = 8)
```

[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_kvae_audio.py#L249)

**Parametreler:**

encoder_dim (`int`, *isteğe bağlı*, varsayılan 64) : Kodlayıcının temel kanal boyutu; her alt örnekleme aşamasında iki katına çıkar.

encoder_rates (`list[int]`, *isteğe bağlı*, varsayılan `[2, 3, 4, 5, 8]`) : Kodlayıcıda örneklem azaltma için adımlar.

latent_dim (`int`, *isteğe bağlı*, varsayılan 2048) : Kodlayıcı çıktısının kanal boyutu (`in_proj` darboğazından önce).

codebook_dim (`int`, *isteğe bağlı*, varsayılan 64) : Posterior dağılımının gizli uzayının kanal boyutu (`in_proj` darboğazından sonra).

decoder_dim (`int`, *isteğe bağlı*, varsayılan 1536) : Çözücünün temel kanal boyutu; her örnekleme aşamasında yarıya iner.

decoder_rates (`list[int]`, *isteğe bağlı*, varsayılan `[8, 5, 4, 3, 2]`) : Dekoderde yukarı örneklemeye ait adımlar.

sample_rate (`int`, *isteğe bağlı*, varsayılan 48000) : Modelin eğitildiği örneklem hızı, Hz cinsinden.

num_channels (`int`, *isteğe bağlı*, varsayılan 1) : Ses verisindeki kanal sayısı (mono için 1).

attn_num_heads (`int`, *isteğe bağlı*, varsayılan 8) : Kodlayıcı çıktısına uygulanan öz-dikkat bloğundaki baş sayısı.

Ham ses dalga formlarını sürekli latentlere kodlamak ve bunları tekrar dalga formlarına çözmek için kullanılan 1B konvolüsyonlu otoenkoder. [KVAE-Audio](https://huggingface.co/kandinskylab/KVAE-Audio) makalesinde tanıtılmıştır.

Bu model [ModelMixin](/docs/diffusers/main/tr/api/models/overview#diffusers.ModelMixin) sınıfından devralır. Tüm modeller için uygulanan genel yöntemlerini (indirme veya kaydetme gibi) görmek için üst sınıfın belgelendirmesine bakın.

#### decode[[diffusers.AutoencoderKLKVAEAudio.decode]]

```python
decode(z: Tensor, return_dict: bool = True)
```

[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_kvae_audio.py#L354)

**Parametreler:**

z (`torch.Tensor`) : Gizil vektörlerin giriş partisi.

return_dict (`bool`, *isteğe bağlı*, varsayılan `True`) : Düz bir tuple yerine [DecoderOutput](/docs/diffusers/main/tr/api/models/autoencoderkl_qwenimage#diffusers.models.autoencoders.vae.DecoderOutput) döndürülüp döndürülmemesi.

**Dönüş:** [DecoderOutput](/docs/diffusers/main/tr/api/models/autoencoderkl_qwenimage#diffusers.models.autoencoders.vae.DecoderOutput) veya `tuple`

return_dict True ise, [DecoderOutput](/docs/diffusers/main/tr/api/models/autoencoderkl_qwenimage#diffusers.models.autoencoders.vae.DecoderOutput) döndürülür, aksi takdirde düz bir `tuple` döndürülür.

Bir latent grubunu ses dalga formlarına çözümler.

#### encode[[diffusers.AutoencoderKLKVAEAudio.encode]]

```python
encode(audio_data: Tensor, return_dict: bool = True)
```

[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_kvae_audio.py#L321)

**Parametreler:**

audio_data (`torch.Tensor`, şekli `(batch_size, num_channels, num_samples)`) : Ham ses dalga formlarından oluşan giriş partisi.

return_dict (`bool`, *isteğe bağlı*, varsayılan `True`) : Düz bir tuple yerine `~models.autoencoder_kl.AutoencoderKLOutput` döndürülüp döndürülmediğini belirtir.

**Dönüş:**

Kodlanmış sesin gizil (latent) temsilleri. `return_dict` True ise bir `~models.autoencoder_kl.AutoencoderKLOutput` döndürülür, aksi halde düz bir `tuple` döndürülür.

Bir ses dalgası grubunu latente kodlayın.

#### forward[[diffusers.AutoencoderKLKVAEAudio.forward]]

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

[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_kvae_audio.py#L379)

**Parametreler:**

sample (`torch.Tensor`, şekli `(batch_size, num_channels, num_samples)`) : Ham ses dalga formlarından oluşan giriş partisi.

sample_posterior (`bool`, *isteğe bağlı*, varsayılan `False`) : Posterior'dan örneklemeye alınıp alınmayacağı.

return_dict (`bool`, *isteğe bağlı*, varsayılan `True`) : Düz bir tuple yerine [DecoderOutput](/docs/diffusers/main/tr/api/models/autoencoderkl_qwenimage#diffusers.models.autoencoders.vae.DecoderOutput) döndürülüp döndürülmemesi.

generator (`torch.Generator`, *isteğe bağlı*) : Örnekleme işlemini deterministik hale getirmek için kullanılan bir [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html).

**Dönüş:** [DecoderOutput](/docs/diffusers/main/tr/api/models/autoencoderkl_qwenimage#diffusers.models.autoencoders.vae.DecoderOutput) veya `tuple`

`return_dict` True ise, [DecoderOutput](/docs/diffusers/main/tr/api/models/autoencoderkl_qwenimage#diffusers.models.autoencoders.vae.DecoderOutput) döndürülür; aksi halde düz bir `tuple` döndürülür.

