All Projects → varungohil → Generalizing-Lottery-Tickets

varungohil / Generalizing-Lottery-Tickets

Licence: MIT license
This repository contains code to replicate the experiments given in NeurIPS 2019 paper "One ticket to win them all: generalizing lottery ticket initializations across datasets and optimizers"

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Generalizing-Lottery-Tickets

GAN-LTH
[ICLR 2021] "GANs Can Play Lottery Too" by Xuxi Chen, Zhenyu Zhang, Yongduo Sui, Tianlong Chen
Stars: ✭ 24 (-50%)
Mutual labels:  pruning, lottery-ticket-hypothesis
ATMC
[NeurIPS'2019] Shupeng Gui, Haotao Wang, Haichuan Yang, Chen Yu, Zhangyang Wang, Ji Liu, “Model Compression with Adversarial Robustness: A Unified Optimization Framework”
Stars: ✭ 41 (-14.58%)
Mutual labels:  pruning
Dynamic Model Pruning with Feedback
Implement of Dynamic Model Pruning with Feedback with pytorch
Stars: ✭ 25 (-47.92%)
Mutual labels:  pruning
transformer generalization
The official repository for our paper "The Devil is in the Detail: Simple Tricks Improve Systematic Generalization of Transformers". We significantly improve the systematic generalization of transformer models on a variety of datasets using simple tricks and careful considerations.
Stars: ✭ 58 (+20.83%)
Mutual labels:  generalization
Recurrent-Independent-Mechanisms
Implementation of the paper Recurrent Independent Mechanisms (https://arxiv.org/pdf/1909.10893.pdf)
Stars: ✭ 90 (+87.5%)
Mutual labels:  generalization
ml-afv
No description or website provided.
Stars: ✭ 44 (-8.33%)
Mutual labels:  neurips-2019
sparsezoo
Neural network model repository for highly sparse and sparse-quantized models with matching sparsification recipes
Stars: ✭ 264 (+450%)
Mutual labels:  pruning
jetbrains-utility
Remove/Backup – settings & cli for macOS (OS X) – DataGrip, AppCode, CLion, Gogland, IntelliJ, PhpStorm, PyCharm, Rider, RubyMine, WebStorm
Stars: ✭ 62 (+29.17%)
Mutual labels:  pruning
CoPINet
Learning Perceptual Inference by Contrasting
Stars: ✭ 24 (-50%)
Mutual labels:  neurips-2019
FisherPruning
Group Fisher Pruning for Practical Network Compression(ICML2021)
Stars: ✭ 127 (+164.58%)
Mutual labels:  pruning
fasterai1
FasterAI: A repository for making smaller and faster models with the FastAI library.
Stars: ✭ 34 (-29.17%)
Mutual labels:  pruning
pomdp-baselines
Simple (but often Strong) Baselines for POMDPs in PyTorch - ICML 2022
Stars: ✭ 162 (+237.5%)
Mutual labels:  generalization
over-parametrization
Computing various norms/measures on over-parametrized neural networks
Stars: ✭ 46 (-4.17%)
Mutual labels:  generalization
torch-model-compression
针对pytorch模型的自动化模型结构分析和修改工具集,包含自动分析模型结构的模型压缩算法库
Stars: ✭ 126 (+162.5%)
Mutual labels:  pruning
Pruning filters for efficient convnets
PyTorch implementation of "Pruning Filters For Efficient ConvNets"
Stars: ✭ 96 (+100%)
Mutual labels:  pruning
Neural-Network-Compression
Paper list for neural network compression techniques
Stars: ✭ 31 (-35.42%)
Mutual labels:  neural-network-compression
neural-compressor
Intel® Neural Compressor (formerly known as Intel® Low Precision Optimization Tool), targeting to provide unified APIs for network compression technologies, such as low precision quantization, sparsity, pruning, knowledge distillation, across different deep learning frameworks to pursue optimal inference performance.
Stars: ✭ 666 (+1287.5%)
Mutual labels:  pruning
paper-notes
ML/DL/RL paper notes
Stars: ✭ 21 (-56.25%)
Mutual labels:  generalization
NaiveNASflux.jl
Your local Flux surgeon
Stars: ✭ 20 (-58.33%)
Mutual labels:  pruning
bert-squeeze
🛠️ Tools for Transformers compression using PyTorch Lightning ⚡
Stars: ✭ 56 (+16.67%)
Mutual labels:  pruning

Generalizing Lottery Tickets

DOI License: MIT

Description

This repository contains PyTorch code to replicate the experiments given in NeurIPS 2019 paper

"One ticket to win them all: generalizing lottery ticket initializations across datasets and optimizers"

As finding the winning lottery tickets is computationally expensive, we also open-source winning tickets (pretrained and pruned models) we generated during our experiments. Link : Winning Tickets

How to Setup

# clone project   
git clone https://github.com/varungohil/Generalizing-Lottery-Tickets.git  

# install all dependencies   
cd Generalizing-Lottery-Tickets    
pip3 install -r requirements.txt

How to Run

There are 4 files in src folder:

  • train.py : Use to train the neural network and find the winning ticket
  • test.py : Use to test the accuracy of the trained model
  • iterative_pruning.py : Use to iteratively prune the model.
  • utils.py : Contains helper functions used in scripts mentioned above

To support more datasets and architectures, we need to add necessary code to utils.py

Using train.py

Mandatory arguments:
  • --architecture : To specify the neural network architecture (vgg19 and resnet50)
  • --dataset : The dataset to train on (cifar10, cifar100, fashionmnist, svhn, cifar10a, cifar10b)
Optional arguments:
  • --batch-size : To set the batch size while training
  • --optimizer : The optimizer to use for training (sgd and adam). sgd used by default
  • --seed : To set the ranodm seed
  • --model-saving-path : Path to directory where trained model is saved.

The trained model will be saved for first 5 epochs. For VGG19 it will be saved for every 16th epoch. FOr Resnet50, the model will be saved for every 9th epoch. For our experiments, while pruning, we reinitialize te model with weights after epoch 2 (late resetting of 1).

# source folder
cd Generalizing-Lottery-Ticket/src   

# run train.py
python3 train.py --architecture=resnet50 --dataset=cifar10    

Using iterative_pruning.py

Mandatory arguments:
  • --architecture : To specify the neural network architecture (vgg19 and resnet50)
  • --target-dataset : The dataset to train on (cifar10, cifar100, fashionmnist, svhn, cifar10a, cifar10b)
  • --source-dataset : The dataset using which winning ticket initialization was found (cifar10, cifar100, fashionmnist, svhn, cifar10a, cifar10b)
  • --init-path : Path to model with winning ticket initialization
Optional arguments:
  • --batch-size : To set the batch size while training
  • --optimizer : The optimizer to use for training (sgd and adam). sgd used by default
  • --seed : To set the ranodm seed
  • --model-saving-path : Path to directory where trained model is saved.

The script will run 30 pruning iterations which will prune away 99.9% of the weights. The trained and pruned model will be saved at end of each pruning iteration

# source folder
cd Generalizing-Lottery-Ticket/src   

# run iterative_pruning.py
python3 iterative_pruning.py --architecture=resnet50 --source-dataset=cifar10 --target-dataset=cifar100 --model-saving-path=<path-to-dir-where-models-are-to-be-stored>

Using test.py

Mandatory arguments:
  • --architecture : To specify the neural network architecture (vgg19 and resnet50)
  • --dataset : The dataset to train on (cifar10, cifar100, fashionmnist, svhn, cifar10a, cifar10b)
  • --model-path : The path to moedl whose accuracy needs to be evaluated.
Optional arguments:
  • --batch-size : To set the batch size while training

Running this script will print the Fraction of pruned weights in the model and the Test Accuracy.

# source folder
cd Generalizing-Lottery-Ticket/src   

# run train.py
python3 test.py --architecture=resnet50 --dataset=cifar10 --model-path=<path-to-model>   

Results

The results of the replicated experiments can be found in plots folder.

Citation

If you use this repository, kindly cite the reproducibility report and the original paper. The bibtex is given below.

@article{Gohil:2020,
  author = {Gohil, Varun and Narayanan, S. Deepak and Jain, Atishay},
  title = {{[Re] One ticket to win them all: generalizing lottery ticket initializations across datasets and optimizers}},
  journal = {ReScience C},
  year = {2020},
  month = may,
  volume = {6},
  number = {2},
  pages = {{#4}},
  doi = {10.5281/zenodo.3818619},
  url = {https://zenodo.org/record/3818619/files/article.pdf},
  code_url = {https://github.com/varungohil/Generalizing-Lottery-Tickets},
  code_doi = {10.5281/zenodo.3700320},
  code_swh = {swh:1:dir:8a9e53bc8a9028428bbad6a4e77ae3fedae49d30},
  data_url = {},
  data_doi = {},
  review_url = {https://openreview.net/forum?id=SklFHaqG6S},
  type = {Replication},
  language = {Python},
  domain = {NeurIPS 2019 Reproducibility Challenge},
  keywords = {lottery ticket hypothesis, pytorch}
}

@incollection{NIPS2019_8739,
title = {One ticket to win them all: generalizing lottery ticket initializations across datasets and optimizers},
author = {Morcos, Ari and Yu, Haonan and Paganini, Michela and Tian, Yuandong},
booktitle = {Advances in Neural Information Processing Systems 32},
editor = {H. Wallach and H. Larochelle and A. Beygelzimer and F. d\textquotesingle Alch\'{e}-Buc and E. Fox and R. Garnett},
pages = {4932--4942},
year = {2019},
publisher = {Curran Associates, Inc.},
url = {http://papers.nips.cc/paper/8739-one-ticket-to-win-them-all-generalizing-lottery-ticket-initializations-across-datasets-and-optimizers.pdf}
}

Core Contributors

Varun Gohil, S. Deepak Narayanan, Atishay Jain

Development

We have a new branch dev in which pull requests are welcome. We will merge them after reviewing.

Contributors

fcorencot

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].