GuoSong c5dd06bb7a | 2 years ago | |
---|---|---|
.. | ||
data | 2 years ago | |
datasets | 2 years ago | |
experiments | 2 years ago | |
models | 2 years ago | |
pre-train | 2 years ago | |
utils | 2 years ago | |
cifar.py | 2 years ago | |
evaluate.py | 2 years ago | |
imagenet-t.py | 2 years ago | |
imagenet.py | 2 years ago | |
readme | 2 years ago | |
test.py | 2 years ago |
#基于1.《lottery jackpots》代码链接:thttps://github.com/zyxxmu/lottery-jackpots.
# 2.《Weight Uncertainty》代码链接:https://github.com/danielkelshaw/WeightUncertainty
#在cifar10上训练
python cifar.py
#imagenet上训练
python imagenet.py
#先验概率使用混合高斯分布,放在文件夹utils下面的scale_mixture.py中实现,高斯变分推断部分在utils下面的gaussian_variational.py中实现
#相比《lottery jackpots》中重写conv2d的conv_type,本代码中重写bn层,放在utils下面的bn_type.py中
#配置选项在utils的options.py中
以下是lottery jackpots中的readme部分
1. Download the pre-trained models from this [link](https://drive.google.com/drive/folders/13et0J5S2iJK9oS-twrKXVqC-tk0AO9Gn?usp=sharing) and place them in the `pre-train` folder.
2. Select a configuration file in `configs` to reproduce the experiment results reported in the paper. For example, to find a lottery jackpot with 30 epochs for pruning 95% parameters of ResNet-32 on CIFAR-10, run:
`python cifar.py --config configs/resnet32_cifar10/90sparsity30epoch.yaml --gpus 0`
To find a lottery jackpot with 30 epochs for pruning 90% parameters of ResNet-50 on ImageNet, run:
`python imagenet.py --config configs/resnet50_imagenet/90sparsity30epoch.yaml --gpus 0`
To further tune the weights of a searched lottery jackpot with 10 epochs for pruning 90% parameters of ResNet-50 on ImageNet, run:
`python imagenet-t.py --config configs/resnet50_imagenet/90sparsity30s10t.yaml --gpus 0`
Note that the `data_path` in the yaml file should be changed to the data.
## Evaluate Our Pruned Models
1. Select a configuration file in `configs` to test the pruned models. For example, to evaluate a lottery jackpot for pruning ResNet-32 on CIFAR-10, run:
`python evaluate.py --config configs/resnet32_cifar10/evaluate.yaml --gpus 0`
To evaluate a lottery jackpot for pruning ResNet-50 on ImageNet, run:
`python evaluate.py --config configs/resnet50_imagenet/evaluate.yaml --gpus 0`
神经网络模型压缩框架
Python Jupyter Notebook Cuda C++ Markdown other
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》