-
Notifications
You must be signed in to change notification settings - Fork 270
/
example_train_script.sh
304 lines (279 loc) · 13.9 KB
/
example_train_script.sh
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# example scripts for running various KD methods
# use cifar10, resnet110 (teacher) and resnet20 (student) as examples
# Baseline
CUDA_VISIBLE_DEVICES=0 python -u train_base.py \
--save_root "./results/base/" \
--data_name cifar10 \
--num_class 10 \
--net_name resnet20 \
--note base-c10-r20
# Logits
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/logits/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode logits \
--lambda_kd 0.1 \
--note logits-c10-r110-r20
# SoftTarget
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/st/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode st \
--lambda_kd 0.1 \
--T 4.0 \
--note st-c10-r110-r20
# AT
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/at/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode at \
--lambda_kd 1000.0 \
--p 2.0 \
--note at-c10-r110-r20
# Fitnet
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/fitnet/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode fitnet \
--lambda_kd 0.1 \
--note fitnet-c10-r110-r20
# NST
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/nst/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode nst \
--lambda_kd 10.0 \
--note nst-c10-r110-r20
# PKT
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/pkt/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode pkt \
--lambda_kd 10000.0 \
--note pkt-c10-r110-r20
# FSP
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/fsp/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode fsp \
--lambda_kd 1.0 \
--note fsp-c10-r110-r20
# FT
CUDA_VISIBLE_DEVICES=0 python -u train_ft.py \
--save_root "./results/ft/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--lambda_kd 200.0 \
--k 0.5 \
--note ft-c10-r110-r20
# RKD
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/rkd/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode rkd \
--lambda_kd 1.0 \
--w_dist 25.0 \
--w_angle 50.0 \
--note rkd-c10-r110-r20
# AB
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/ab/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode ab \
--lambda_kd 10.0 \
--m 2.0 \
--note ab-c10-r110-r20
# SP
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/sp/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode sp \
--lambda_kd 3000.0 \
--note sp-c10-r110-r20
# Sobolev
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/sobolev/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode sobolev \
--lambda_kd 20.0 \
--note sobolev-c10-r110-r20
# BSS
CUDA_VISIBLE_DEVICES=0 python -u train_bss.py \
--save_root "./results/bss/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--lambda_kd 2.0 \
--T 3.0 \
--attack_size 32 \
--note bss-c10-r110-r20
# CC
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/cc/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode cc \
--lambda_kd 100.0 \
--gamma 0.4 \
--P_order 2 \
--note cc-c10-r110-r20
# LwM
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/lwm/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode lwm \
--lambda_kd 0.4 \
--note lwm-c10-r110-r20
# IRG
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/irg/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode irg \
--lambda_kd 1.0 \
--w_irg_vert 0.1 \
--w_irg_edge 5.0 \
--w_irg_tran 5.0 \
--note irg-c10-r110-r20
# VID
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/vid/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode vid \
--lambda_kd 1.0 \
--sf 1.0 \
--init_var 5.0 \
--note vid-c10-r110-r20
# OFD
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/ofd/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode ofd \
--lambda_kd 0.5 \
--note ofd-c10-r110-r20
# AFD
CUDA_VISIBLE_DEVICES=0 python -u train_kd.py \
--save_root "./results/afd/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--kd_mode afd \
--lambda_kd 500.0 \
--att_f 1.0 \
--note afd-c10-r110-r20
# CRD
# lambda_kd=0.2 for CIFAR10, lambda_kd=0.8 for CIFAR100.
CUDA_VISIBLE_DEVICES=0 python -u train_crd.py \
--save_root "./results/crd/" \
--t_model "./results/base/base-c10-r110/model_best.pth.tar" \
--s_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--t_name resnet110 \
--s_name resnet20 \
--lambda_kd 0.2 \
--feat_dim 128 \
--nce_n 16384 \
--nce_t 0.1 \
--nce_mom 0.5 \
--mode 'exact' \
--note crd-c10-r110-r20
# DML
CUDA_VISIBLE_DEVICES=0 python -u train_dml.py \
--save_root "./results/dml/" \
--net1_init "./results/base/base-c10-r110/initial_r110.pth.tar" \
--net2_init "./results/base/base-c10-r20/initial_r20.pth.tar" \
--data_name cifar10 \
--num_class 10 \
--net1_name resnet110 \
--net2_name resnet20 \
--lambda_kd 1.0 \
--note dml-c10-r110-r20