The Variational Autoencoder (VAE) is the first stage of the Chemeleon2 pipeline. It learns to encode crystal structures into a continuous latent space.
The VAE is the first stage of Chemeleon2 that encodes crystal structures into continuous latent space representations. For architectural details, see VAE Module.
# Train VAE on MP-20 dataset (src/train_vae.py)
python src/train_vae.py experiment=mp_20/vae_dngTraining script: src/train_vae.py
Example config: configs/experiment/mp_20/vae_dng.yaml
:::{tip} Example training run: See this W&B run for a successful VAE training example on MP-20 dataset. :::
# Use experiment config
python src/train_vae.py experiment=mp_20/vae_dng
# Override training parameters
python src/train_vae.py experiment=mp_20/vae_dng \
trainer.max_epochs=3000 \
data.batch_size=128python src/train_vae.py experiment=mp_20/vae_dng \
ckpt_path=ckpts/vae_checkpoint.ckpt| Parameter | Default | Description |
|---|---|---|
latent_dim |
8 | Dimension of latent space |
hidden_dim |
512 | Hidden dimension in encoder/decoder (d_model) |
num_layers |
8 | Number of transformer layers |
kl_weight |
1e-5 | KL divergence loss weight |
python src/train_vae.py experiment=mp_20/vae_dng \
vae_module.latent_dim=16 \
vae_module.kl_weight=1e-4| Experiment | Dataset | Description |
|---|---|---|
mp_20/vae_dng |
MP-20 | VAE for de novo generation |
Key metrics to watch in WandB:
train/recon_loss: Reconstruction loss (should decrease)train/kl_loss: KL divergence (should stabilize)val/recon_loss: Validation reconstruction (check for overfitting)
- Duration: ~1000-5000 epochs
- Batch size: 64-256 depending on GPU memory
- Learning rate: 1e-4 (default)
After training VAE:
- Note the checkpoint path
- Proceed to LDM Training using your VAE checkpoint