Code for this paper GANs Can Play Lottery Tickets Too.
For a range of GANs, we can find matching subnetworks at 67%-74% sparsity. We observe that with or without pruning discriminator has a minor effect on the existence and quality of matching subnetworks, while the initialization used in the discriminator plays a significant role.
Iterative pruning results on SNGAN
pytorch==1.4.0
tensorflow-gpu=1.15.0
imageio
scikit-image
tqdm
tensorboardx
mkdir initial_weights
python generate_initial_weights.py --model sngan_cifar10
Download FID statistics files from here to fid_stat
.
python train.py --model sngan_cifar10 --exp_name sngan_cifar10 --init-path initial_weights
Baseline models are also available here.
python train_impg.py --model sngan_cifar10 --exp_name sngan_cifar10 --init-path initial_weights --load-path <path/to/log>
python train_impgd.py --model sngan_cifar10 --exp_name sngan_cifar10 --init-path initial_weights
python train_impgd.py --model sngan_cifar10 --exp_name sngan_cifar10 --init-path initial_weights --use-kd-d
mkdir initial_weights
python generate_initial_weights.py
./download_dataset DATASET_NAME
python train.py --dataset DATASET_NAME --rand initial_weights --gpu GPU
python train_impg.py --dataset DATASET_NAME --rand initial_weights --gpu GPU --pretrain PRETRAIN
python train_impg.py --dataset DATASET_NAME --rand initial_weights --gpu GPU --pretrain PRETRAIN
Inception Score code from OpenAI's Improved GAN (official), and the FID code and CIFAR-10 statistics file from https://github.com/bioinf-jku/TTUR (official).