Implementation of Real NVP in PyTorch. Based on the paper:
Density estimation using Real NVP
Laurent Dinh, Jascha Sohl-Dickstein, Samy Bengio
arXiv:1605.08803
Training script and hyperparameters designed to match the CIFAR-10 experiments described in Section 4.1 of the paper.
- Make sure you have Anaconda or Miniconda installed.
- Clone repo with
git clone https://github.com/chrischute/real-nvp.git rnvp
. - Go into the cloned repo:
cd rnvp
. - Create the environment:
conda env create -f environment.yml
. - Activate the environment:
source activate rnvp
.
- Make sure you've created and activated the conda environment as described above.
- Run
python train.py -h
to see options. - Run
python train.py [FLAGS]
to train. E.g., runpython train.py
for the default configuration, or runpython train.py --gpu_ids=[0,1] --batch_size=128
to run on 2 GPUs instead of the default of 1 GPU. - At the end of each epoch, samples from the model will be saved to
samples/epoch_N.png
, whereN
is the epoch number.
One epoch takes about 4 minutes when using the default arguments and running on an NVIDIA Titan Xp card.
Epoch | Train | Valid |
---|---|---|
5 | 3.97 | 3.98 |
10 | 3.76 | 3.76 |
15 | 3.69 | 3.74 |
20 | 3.65 | 3.70 |
25 | 3.62 | 3.74 |