forked from ganguli-lab/Synaptic-Flow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmd_generator.py
More file actions
35 lines (29 loc) · 1.73 KB
/
cmd_generator.py
File metadata and controls
35 lines (29 loc) · 1.73 KB
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
#!/usr/bin/env python3
BASE = "python3 main.py --dataset cifar10 --model-class lottery --optimizer momentum --train-batch-size 128 --post-epochs 160 --lr-drops 80 120 --weight-decay 1e-4 --expid results --verbose"
# With pruning
for compression in range(1, 4):
for levels in [1, 3]:
for model in ['wide-resnet32', 'vgg16-bn']:
for pruner in ['synflow', 'mag']:
for random_prune in [True, False]:
for random_train in [True, False]:
lr = 0.1
result_dir = f'levels-{levels}-{model}-{pruner}-lr-{lr}-{random_prune}-{random_train}-sparsity-{compression}'
cmd = ' '.join([BASE, f'--model={model}', f'--lr={lr}', f'--pruner={pruner}', f'--compression={compression}', f'--result-dir={result_dir}', f'--level-list {levels}'])
if pruner == 'mag':
cmd += ' --pre-epochs 160'
cmd += ' --experiment multishot'
if random_prune:
cmd += ' --prune-corrupt=1.0'
if random_train:
cmd += ' --train-corrupt=1.0'
print(cmd + '\n')
print('=' * 20 + ' train only ' + '=' * 20)
for model in ['wide-resnet32', 'vgg16-bn']:
for random_train in [True, False]:
lr = 0.1
result_dir = f'no-prune-{model}-{lr}-{random_train}'
cmd = ' '.join([BASE, f'--model={model}', f'--lr={lr}', '--compression=0', f'--result-dir={result_dir}', '--prune-epochs=0'])
if random_train:
cmd += ' --train-corrupt=1.0'
print(cmd + '\n')