Accompanying code for my Medium article: A Basic Variational Autoencoder in PyTorch Trained on the CelebA Dataset .
Files:
vae.py
: ClassVAE
+ some definitions. You can changeIMAGE_SIZE
,LATENT_DIM
, andCELEB_PATH
.trainvae.py
: Main code, training and testing. You can changeEPOCHS
andBATCH_SIZE
. The models and images are placed in a directoryvaemodels-??????
, where??????
are 6 random characters.utils.py
: a couple of small utility functions.genpics.py
: creates a panel of original image + 7 reconstructed ones.vae_model_20.pth
: a trained VAE.
Running a trained model on a CPU is fine.
Training on a CPU is possible, but slow: ⚡👉 GPU.