Vector Quantized VAE¶
This module is the implementation of the Vector Quantized VAE proposed in (https://arxiv.org/abs/1711.00937).
Available samplers¶
Normalizing flows sampler to come.
Fits a Gaussian Mixture in the Autoencoder’s latent space. |
|
Fits a Masked Autoregressive Flow in the Autoencoder’s latent space. |
|
Fits an Inverse Autoregressive Flow in the Autoencoder’s latent space. |
- class pythae.models.VQVAEConfig(input_dim=None, latent_dim=10, uses_default_encoder=True, uses_default_decoder=True, commitment_loss_factor=0.25, quantization_loss_factor=1.0, num_embeddings=512, use_ema=False, decay=0.99)[source]¶
Vector Quantized VAE model config config class
- Parameters
input_dim (tuple) – The input_data dimension.
latent_dim (int) – The latent space dimension. Default: None.
commitment_loss_factor (float) – The commitment loss factor in the loss. Default: 0.25.
quantization_loss_factor – The quantization loss factor in the loss. Default: 1.
num_embedding (int) – The number of embedding points. Default: 512
use_ema (bool) – Whether to use the Exponential Movng Average Update (EMA). Default: False.
decay (float) – The decay to apply in the EMA update. Must be in [0, 1]. Default: 0.99.
- class pythae.models.VQVAE(model_config, encoder=None, decoder=None)[source]¶
Vector Quantized-VAE model.
- Parameters
model_config (VQVAEConfig) – The Variational Autoencoder configuration setting the main parameters of the model.
encoder (BaseEncoder) – An instance of BaseEncoder (inheriting from torch.nn.Module which plays the role of encoder. This argument allows you to use your own neural networks architectures if desired. If None is provided, a simple Multi Layer Preception (https://en.wikipedia.org/wiki/Multilayer_perceptron) is used. Default: None.
decoder (BaseDecoder) – An instance of BaseDecoder (inheriting from torch.nn.Module which plays the role of encoder. This argument allows you to use your own neural networks architectures if desired. If None is provided, a simple Multi Layer Preception (https://en.wikipedia.org/wiki/Multilayer_perceptron) is used. Default: None.
Note
For high dimensional data we advice you to provide you own network architectures. With the provided MLP you may end up with a
MemoryError.