Skip to content

Variational Autoencoder (VAE), Evidence Lower Bound (ELBO) Implementation (PyTorch)

Notifications You must be signed in to change notification settings

drawcodeboy/VAE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8fc2128 · Mar 17, 2025

History

53 Commits
Mar 17, 2025
Mar 17, 2025
Dec 28, 2024
Mar 17, 2025
Mar 17, 2025
Dec 29, 2024
Mar 17, 2025
Mar 16, 2025
Dec 29, 2024
Mar 17, 2025
Mar 17, 2025
Mar 17, 2025
Mar 15, 2025

Repository files navigation

VAE Implementation with PyTorch

Description

  • This is Variational Autoencoder(VAE) Implementation with PyTorch!

Preview: CelebA

(1) Reconstruction

(2) Generation

Preview: MNIST

(1) Reconstruction

(2) Generation

(3) Latent Space t-SNE

Installation

# Docker (Optional)
docker pull ubuntu:22.04
docker run -itd --gpus=all --shm-size=16G --name=vae ubuntu:22.04 /bin/bash

apt-get update
apt-get install sudo
sudo apt-get install git
sudo apt-get install gdown # For CelebA Dataset
sudo apt-get install unzip
sudo apt-get install -y libgl1-mesa-glx # OpenCV
sudo apt-get install -y libglib2.0-0 # OpenCV

# Download
git clone https://github.com/drawcodeboy/VAE.git
cd VAE

# Download CelebA
gdown --id 1m8-EBPgi5MRubrm6iQjafK2QMHDBMSfJ --output data/
unzip data/celeba.zip -d data/
unzip data/celeba/img_align_celeba.zip -d data/celeba/

# Install Python
sudo apt-get install python3
sudo apt-get install python3-venv

# Virtual Environment
python3 venv -m .venv
source .venv/bin/activate

# Install packages
pip install -r requirements.txt

# train MNIST
python train.py --config=vae.mnist

# train CelebA
python train.py --config=vae.celeba

# test MNIST
python test.py --config=vae.mnist

# test CelebA
python test.py --config=vae.celeba

References

  1. VAE: Kingma, D. P. (2013). Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114.

About

Variational Autoencoder (VAE), Evidence Lower Bound (ELBO) Implementation (PyTorch)

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages