-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathresnet50_pruned_85_schedule.yaml
executable file
·187 lines (172 loc) · 16.1 KB
/
resnet50_pruned_85_schedule.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# This schedule demonstrates high-rate element-wise pruning (84.57% sparsity) of Resnet 50.
# ************************************************************
# Accuracy Performance
# ************************************************************
# +----------------------+------------------+----------------+
# | Accuracy Metric | Pruned Model | Base Model |
# +----------------------+------------------+----------------+
# | Top1 | 75.516 | 76.15 |
# | Top5 | 92.718 | 92.87 |
# +----------------------+------------------+----------------+
# ************************************************************
# Distiller Command Line
# ************************************************************
# Training : python compress_classifier.py -a=resnet50 --pretrained -p=100 PATH_TO_IMAGENET_DATA -j=8 -b=32 --epochs=120 --lr=0.001 --compress=PATH_TO_THIS_FILE
# Evaluation : python compress_classifier.py -a resnet50 --resume PATH_TO_CHEKCPOINT PATH_TO_IMAGENET_VAL_DATA --evaluate
# Quantization : python compress_classifier.py -a resnet50 --resume PATH_TO_CHEKCPOINT PATH_TO_IMAGENET_VAL_DATA --evaluate --quantize-eval --qe-mode asym_u
# ************************************************************
# Best epoch (100)
# ************************************************************
# ************************************************************
# Sparsity Profile
# ************************************************************
# The pruning level is uniform across all layers (85%), except for the first convolution. The last Linear layer is
# pruned to 80% sparsity.
#
# Parameters:
# +----+-------------------------------------+--------------------+---------------+----------------+------------+------------+----------+----------+----------+------------+---------+----------+------------+
# | | Name | Shape | NNZ (dense) | NNZ (sparse) | Cols (%) | Rows (%) | Ch (%) | 2D (%) | 3D (%) | Fine (%) | Std | Mean | Abs-Mean |
# |----+-------------------------------------+--------------------+---------------+----------------+------------+------------+----------+----------+----------+------------+---------+----------+------------|
# | 0 | module.conv1.weight | (64, 3, 7, 7) | 9408 | 9408 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.10924 | -0.00036 | 0.06776 |
# | 1 | module.layer1.0.conv1.weight | (64, 64, 1, 1) | 4096 | 615 | 0.00000 | 0.00000 | 1.56250 | 84.98535 | 7.81250 | 84.98535 | 0.04033 | -0.00253 | 0.01312 |
# | 2 | module.layer1.0.conv2.weight | (64, 64, 3, 3) | 36864 | 5530 | 0.00000 | 0.00000 | 7.81250 | 46.58203 | 6.25000 | 84.99891 | 0.02094 | 0.00046 | 0.00657 |
# | 3 | module.layer1.0.conv3.weight | (256, 64, 1, 1) | 16384 | 2458 | 0.00000 | 0.00000 | 6.25000 | 84.99756 | 16.01562 | 84.99756 | 0.02432 | 0.00024 | 0.00811 |
# | 4 | module.layer1.0.downsample.0.weight | (256, 64, 1, 1) | 16384 | 2458 | 0.00000 | 0.00000 | 1.56250 | 84.99756 | 14.06250 | 84.99756 | 0.03310 | -0.00148 | 0.01098 |
# | 5 | module.layer1.1.conv1.weight | (64, 256, 1, 1) | 16384 | 2458 | 0.00000 | 0.00000 | 12.89062 | 84.99756 | 6.25000 | 84.99756 | 0.02059 | 0.00071 | 0.00702 |
# | 6 | module.layer1.1.conv2.weight | (64, 64, 3, 3) | 36864 | 5530 | 0.00000 | 0.00000 | 6.25000 | 41.28418 | 0.00000 | 84.99891 | 0.01944 | 0.00014 | 0.00639 |
# | 7 | module.layer1.1.conv3.weight | (256, 64, 1, 1) | 16384 | 2458 | 0.00000 | 0.00000 | 0.00000 | 84.99756 | 14.84375 | 84.99756 | 0.02170 | 0.00009 | 0.00734 |
# | 8 | module.layer1.2.conv1.weight | (64, 256, 1, 1) | 16384 | 2458 | 0.00000 | 0.00000 | 9.76562 | 84.99756 | 0.00000 | 84.99756 | 0.01955 | -0.00012 | 0.00677 |
# | 9 | module.layer1.2.conv2.weight | (64, 64, 3, 3) | 36864 | 5530 | 0.00000 | 0.00000 | 0.00000 | 37.30469 | 0.00000 | 84.99891 | 0.02036 | -0.00028 | 0.00715 |
# | 10 | module.layer1.2.conv3.weight | (256, 64, 1, 1) | 16384 | 2458 | 0.00000 | 0.00000 | 0.00000 | 84.99756 | 16.40625 | 84.99756 | 0.02110 | -0.00097 | 0.00710 |
# | 11 | module.layer2.0.conv1.weight | (128, 256, 1, 1) | 32768 | 4916 | 0.00000 | 0.00000 | 5.46875 | 84.99756 | 0.00000 | 84.99756 | 0.02154 | -0.00056 | 0.00745 |
# | 12 | module.layer2.0.conv2.weight | (128, 128, 3, 3) | 147456 | 22119 | 0.00000 | 0.00000 | 0.00000 | 43.91479 | 0.00000 | 84.99959 | 0.01366 | -0.00009 | 0.00466 |
# | 13 | module.layer2.0.conv3.weight | (512, 128, 1, 1) | 65536 | 9831 | 0.00000 | 0.00000 | 0.00000 | 84.99908 | 22.46094 | 84.99908 | 0.01814 | 0.00017 | 0.00593 |
# | 14 | module.layer2.0.downsample.0.weight | (512, 256, 1, 1) | 131072 | 19661 | 0.00000 | 0.00000 | 0.00000 | 84.99985 | 12.50000 | 84.99985 | 0.01386 | -0.00019 | 0.00426 |
# | 15 | module.layer2.1.conv1.weight | (128, 512, 1, 1) | 65536 | 9831 | 0.00000 | 0.00000 | 13.08594 | 84.99908 | 0.00000 | 84.99908 | 0.01173 | 0.00016 | 0.00369 |
# | 16 | module.layer2.1.conv2.weight | (128, 128, 3, 3) | 147456 | 22119 | 0.00000 | 0.00000 | 0.00000 | 47.70508 | 0.00000 | 84.99959 | 0.01402 | 0.00020 | 0.00463 |
# | 17 | module.layer2.1.conv3.weight | (512, 128, 1, 1) | 65536 | 9831 | 0.00000 | 0.00000 | 0.00000 | 84.99908 | 12.50000 | 84.99908 | 0.01554 | -0.00074 | 0.00493 |
# | 18 | module.layer2.2.conv1.weight | (128, 512, 1, 1) | 65536 | 9831 | 0.00000 | 0.00000 | 1.75781 | 84.99908 | 0.00000 | 84.99908 | 0.01518 | -0.00034 | 0.00502 |
# | 19 | module.layer2.2.conv2.weight | (128, 128, 3, 3) | 147456 | 22119 | 0.00000 | 0.00000 | 0.00000 | 40.46631 | 0.00000 | 84.99959 | 0.01398 | -0.00009 | 0.00462 |
# | 20 | module.layer2.2.conv3.weight | (512, 128, 1, 1) | 65536 | 9831 | 0.00000 | 0.00000 | 0.00000 | 84.99908 | 1.75781 | 84.99908 | 0.01675 | -0.00024 | 0.00563 |
# | 21 | module.layer2.3.conv1.weight | (128, 512, 1, 1) | 65536 | 9831 | 0.00000 | 0.00000 | 1.56250 | 84.99908 | 0.00000 | 84.99908 | 0.01536 | -0.00032 | 0.00523 |
# | 22 | module.layer2.3.conv2.weight | (128, 128, 3, 3) | 147456 | 22119 | 0.00000 | 0.00000 | 0.00000 | 34.95483 | 0.00000 | 84.99959 | 0.01406 | -0.00026 | 0.00481 |
# | 23 | module.layer2.3.conv3.weight | (512, 128, 1, 1) | 65536 | 9831 | 0.00000 | 0.00000 | 0.00000 | 84.99908 | 6.83594 | 84.99908 | 0.01596 | -0.00025 | 0.00533 |
# | 24 | module.layer3.0.conv1.weight | (256, 512, 1, 1) | 131072 | 19661 | 0.00000 | 0.00000 | 0.00000 | 84.99985 | 0.00000 | 84.99985 | 0.01874 | -0.00038 | 0.00644 |
# | 25 | module.layer3.0.conv2.weight | (256, 256, 3, 3) | 589824 | 88474 | 0.00000 | 0.00000 | 0.00000 | 49.69635 | 0.00000 | 84.99993 | 0.01050 | -0.00010 | 0.00351 |
# | 26 | module.layer3.0.conv3.weight | (1024, 256, 1, 1) | 262144 | 39322 | 0.00000 | 0.00000 | 0.00000 | 84.99985 | 4.58984 | 84.99985 | 0.01470 | 0.00001 | 0.00500 |
# | 27 | module.layer3.0.downsample.0.weight | (1024, 512, 1, 1) | 524288 | 78644 | 0.00000 | 0.00000 | 0.00000 | 84.99985 | 4.00391 | 84.99985 | 0.00995 | -0.00005 | 0.00317 |
# | 28 | module.layer3.1.conv1.weight | (256, 1024, 1, 1) | 262144 | 39322 | 0.00000 | 0.00000 | 4.58984 | 84.99985 | 0.00000 | 84.99985 | 0.01117 | -0.00010 | 0.00364 |
# | 29 | module.layer3.1.conv2.weight | (256, 256, 3, 3) | 589824 | 88474 | 0.00000 | 0.00000 | 0.00000 | 42.34161 | 0.00000 | 84.99993 | 0.01019 | -0.00009 | 0.00337 |
# | 30 | module.layer3.1.conv3.weight | (1024, 256, 1, 1) | 262144 | 39322 | 0.00000 | 0.00000 | 0.00000 | 84.99985 | 0.68359 | 84.99985 | 0.01334 | -0.00070 | 0.00446 |
# | 31 | module.layer3.2.conv1.weight | (256, 1024, 1, 1) | 262144 | 39322 | 0.00000 | 0.00000 | 0.68359 | 84.99985 | 0.00000 | 84.99985 | 0.01082 | -0.00014 | 0.00349 |
# | 32 | module.layer3.2.conv2.weight | (256, 256, 3, 3) | 589824 | 88474 | 0.00000 | 0.00000 | 0.00000 | 35.22644 | 0.00000 | 84.99993 | 0.00988 | -0.00028 | 0.00330 |
# | 33 | module.layer3.2.conv3.weight | (1024, 256, 1, 1) | 262144 | 39322 | 0.00000 | 0.00000 | 0.00000 | 84.99985 | 0.29297 | 84.99985 | 0.01223 | -0.00025 | 0.00410 |
# | 34 | module.layer3.3.conv1.weight | (256, 1024, 1, 1) | 262144 | 39322 | 0.00000 | 0.00000 | 0.19531 | 84.99985 | 0.00000 | 84.99985 | 0.01171 | -0.00014 | 0.00387 |
# | 35 | module.layer3.3.conv2.weight | (256, 256, 3, 3) | 589824 | 88474 | 0.00000 | 0.00000 | 0.00000 | 34.43451 | 0.00000 | 84.99993 | 0.00988 | -0.00027 | 0.00332 |
# | 36 | module.layer3.3.conv3.weight | (1024, 256, 1, 1) | 262144 | 39322 | 0.00000 | 0.00000 | 0.00000 | 84.99985 | 0.68359 | 84.99985 | 0.01198 | -0.00044 | 0.00404 |
# | 37 | module.layer3.4.conv1.weight | (256, 1024, 1, 1) | 262144 | 39322 | 0.00000 | 0.00000 | 0.09766 | 84.99985 | 0.00000 | 84.99985 | 0.01200 | -0.00029 | 0.00402 |
# | 38 | module.layer3.4.conv2.weight | (256, 256, 3, 3) | 589824 | 88474 | 0.00000 | 0.00000 | 0.00000 | 35.46906 | 0.00000 | 84.99993 | 0.00984 | -0.00035 | 0.00333 |
# | 39 | module.layer3.4.conv3.weight | (1024, 256, 1, 1) | 262144 | 39322 | 0.00000 | 0.00000 | 0.00000 | 84.99985 | 0.68359 | 84.99985 | 0.01216 | -0.00063 | 0.00412 |
# | 40 | module.layer3.5.conv1.weight | (256, 1024, 1, 1) | 262144 | 39322 | 0.00000 | 0.00000 | 0.00000 | 84.99985 | 0.00000 | 84.99985 | 0.01271 | -0.00020 | 0.00433 |
# | 41 | module.layer3.5.conv2.weight | (256, 256, 3, 3) | 589824 | 88474 | 0.00000 | 0.00000 | 0.00000 | 37.98981 | 0.00000 | 84.99993 | 0.01005 | -0.00035 | 0.00343 |
# | 42 | module.layer3.5.conv3.weight | (1024, 256, 1, 1) | 262144 | 39322 | 0.00000 | 0.00000 | 0.00000 | 84.99985 | 0.87891 | 84.99985 | 0.01306 | -0.00102 | 0.00452 |
# | 43 | module.layer4.0.conv1.weight | (512, 1024, 1, 1) | 524288 | 78644 | 0.00000 | 0.00000 | 0.00000 | 84.99985 | 0.00000 | 84.99985 | 0.01455 | -0.00022 | 0.00514 |
# | 44 | module.layer4.0.conv2.weight | (512, 512, 3, 3) | 2359296 | 353895 | 0.00000 | 0.00000 | 0.00000 | 49.08714 | 0.00000 | 84.99997 | 0.00791 | -0.00011 | 0.00273 |
# | 45 | module.layer4.0.conv3.weight | (2048, 512, 1, 1) | 1048576 | 157287 | 0.00000 | 0.00000 | 0.00000 | 84.99994 | 0.00000 | 84.99994 | 0.01091 | -0.00011 | 0.00379 |
# | 46 | module.layer4.0.downsample.0.weight | (2048, 1024, 1, 1) | 2097152 | 314573 | 0.00000 | 0.00000 | 0.00000 | 84.99999 | 0.00000 | 84.99999 | 0.00737 | -0.00012 | 0.00241 |
# | 47 | module.layer4.1.conv1.weight | (512, 2048, 1, 1) | 1048576 | 157287 | 0.00000 | 0.00000 | 0.00000 | 84.99994 | 0.00000 | 84.99994 | 0.01137 | -0.00017 | 0.00391 |
# | 48 | module.layer4.1.conv2.weight | (512, 512, 3, 3) | 2359296 | 353895 | 0.00000 | 0.00000 | 0.00000 | 44.54308 | 0.00000 | 84.99997 | 0.00842 | -0.00031 | 0.00294 |
# | 49 | module.layer4.1.conv3.weight | (2048, 512, 1, 1) | 1048576 | 157287 | 0.00000 | 0.00000 | 0.00000 | 84.99994 | 0.00000 | 84.99994 | 0.01138 | 0.00012 | 0.00399 |
# | 50 | module.layer4.2.conv1.weight | (512, 2048, 1, 1) | 1048576 | 157287 | 0.00000 | 0.00000 | 0.00000 | 84.99994 | 0.00000 | 84.99994 | 0.01319 | -0.00006 | 0.00464 |
# | 51 | module.layer4.2.conv2.weight | (512, 512, 3, 3) | 2359296 | 353895 | 0.00000 | 0.00000 | 0.00000 | 59.38873 | 0.00000 | 84.99997 | 0.00700 | -0.00017 | 0.00255 |
# | 52 | module.layer4.2.conv3.weight | (2048, 512, 1, 1) | 1048576 | 157287 | 0.00000 | 0.00000 | 0.00000 | 84.99994 | 0.04883 | 84.99994 | 0.00929 | 0.00024 | 0.00325 |
# | 53 | module.fc.weight | (1000, 2048) | 2048000 | 409600 | 0.00000 | 0.04883 | 0.00000 | 0.00000 | 0.00000 | 80.00000 | 0.03176 | 0.00393 | 0.01232 |
# | 54 | Total sparsity: | - | 25502912 | 3935859 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 84.56702 | 0.00000 | 0.00000 | 0.00000 |
# +----+-------------------------------------+--------------------+---------------+----------------+------------+------------+----------+----------+----------+------------+---------+----------+------------+
# Total sparsity: 84.57
# Ideal Number of MACS: 0.714 Billion
version: 1
pruners:
fc_pruner:
class: AutomatedGradualPruner
initial_sparsity : 0.05
final_sparsity: 0.80
weights: module.fc.weight
conv_pruner:
class: AutomatedGradualPruner
initial_sparsity : 0.05
final_sparsity: 0.85
weights: [
#module.conv1.weight,
module.layer1.0.conv1.weight,
module.layer1.0.conv2.weight,
module.layer1.0.conv3.weight,
module.layer1.0.downsample.0.weight,
module.layer1.1.conv1.weight,
module.layer1.1.conv2.weight,
module.layer1.1.conv3.weight,
module.layer1.2.conv1.weight,
module.layer1.2.conv2.weight,
module.layer1.2.conv3.weight,
module.layer2.0.conv1.weight,
module.layer2.0.conv2.weight,
module.layer2.0.conv3.weight,
module.layer2.0.downsample.0.weight,
module.layer2.1.conv1.weight,
module.layer2.1.conv2.weight,
module.layer2.1.conv3.weight,
module.layer2.2.conv1.weight,
module.layer2.2.conv2.weight,
module.layer2.2.conv3.weight,
module.layer2.3.conv1.weight,
module.layer2.3.conv2.weight,
module.layer2.3.conv3.weight,
module.layer3.0.conv1.weight,
module.layer3.0.conv2.weight,
module.layer3.0.conv3.weight,
module.layer3.0.downsample.0.weight,
module.layer3.1.conv1.weight,
module.layer3.1.conv2.weight,
module.layer3.1.conv3.weight,
module.layer3.2.conv1.weight,
module.layer3.2.conv2.weight,
module.layer3.2.conv3.weight,
module.layer3.3.conv1.weight,
module.layer3.3.conv2.weight,
module.layer3.3.conv3.weight,
module.layer3.4.conv1.weight,
module.layer3.4.conv2.weight,
module.layer3.4.conv3.weight,
module.layer3.5.conv1.weight,
module.layer3.5.conv2.weight,
module.layer3.5.conv3.weight,
module.layer4.0.conv1.weight,
module.layer4.0.conv2.weight,
module.layer4.0.conv3.weight,
module.layer4.0.downsample.0.weight,
module.layer4.1.conv1.weight,
module.layer4.1.conv2.weight,
module.layer4.1.conv3.weight,
module.layer4.2.conv1.weight,
module.layer4.2.conv2.weight,
module.layer4.2.conv3.weight]
lr_schedulers:
pruning_lr:
class: ExponentialLR
gamma: 0.95
policies:
- pruner:
instance_name : conv_pruner
starting_epoch: 0
ending_epoch: 35
frequency: 1
- pruner:
instance_name : fc_pruner
starting_epoch: 1
ending_epoch: 35
frequency: 1
- lr_scheduler:
instance_name: pruning_lr
starting_epoch: 40
ending_epoch: 100
frequency: 1