https://arxiv.org/abs/1807.03039
Pytorch implementation of Glow model for datasets: Galaxy10, MNIST, CelebA
To train a model using pytorch distributed package:
python -m torch.distributed.launch --nproc_per_node=NUM_GPUS_YOU_HAVE \
glow.py --train \
--distributed \
--dataset=celeba \
--data_dir=[path to data source] \
--n_levels=3 \
--depth=32 \
--width=512 \
--batch_size=16 [this is per GPU]
To evaluate model:
python glow.py --evaluate \
--restore_file=[path to .pt checkpoint] \
--dataset=celeba \
--data_dir=[path to data source] \
--[options of the saved model: n_levels, depth, width, batch_size]
To generate samples from a trained model:
python glow.py --generate \
--restore_file=[path to .pt checkpoint] \
--dataset=celeba \
--data_dir=[path to data source] \
--[options of the saved model: n_levels, depth, width, batch_size] \
--z_std=[temperature parameter; if blank, generates range]
To visualize manipulations on specific image given a trained model:
python glow.py --visualize \
--restore_file=[path to .pt checkpoint] \
--dataset=celeba \
--data_dir=[path to data source] \
--[options of the saved model: n_levels, depth, width, batch_size] \
--z_std=[temperature parameter; if blank, uses default] \
--vis_attrs=[list of indices of attribute to be manipulated, if blank, manipulates every attribute] \
--vis_alphas=[list of values by which `dz` should be multiplied, defaults [-2,2]] \
--vis_img=[path to image to manipulate (note: size needs to match dataset); if blank uses example from test dataset]
- python 3.6
- pytorch 1.0
- numpy
- matplotlib
- tensorboardX