-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample_script_score_based_pruning.sh
30 lines (22 loc) · 1.36 KB
/
sample_script_score_based_pruning.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
#!/bin/bash
model_name="NAME_OF_PRUNED_MODEL"
path="/MODEL_PATH/" + $model_name
arch="WideResNet50_2"
pruning_type="local"
k=0.1
augmentation="pixmix"
# Calculate Score Based importance mask
python -u calculate_score_based_mask.py --arch $arch --model_name $model_name --k $k --save-dense --scaled-score-init --path $path --epochs 20 --augmentation $augmentation --exp-mode "prune" --layer-type "subnet" --init_type "kaiming_normal" --pruning_type $pruning_type
# Retrain based on local computed importance score
python -u prune_with_augmentation.py --augmentation $augmentation --pretrained --arch $arch --model_name $model_name --prune --pruning_type $pruning_type --pruning_ratio $pruning_ratio --all-ops --lr 0.01 --batch_size 256 --epochs 20
# Evaluate on ImageNet
python -u evaluate_imagenet_c.py --arch $arch --path $path
# Evaluate on ImageNet-C
python -u evaluate_imagenet_c.py --arch $arch --path $path --corruption
#Evalate on ImageNet-Patch
for ((seed=0;seed<=19;seed++)); do
python -u evaluate_imagenet_patch.py --arch $arch --path $path --patch "bernoulli" --seed $seed
python -u evaluate_imagenet_patch.py --arch $arch --path $path --patch "srs_rn18" --seed $seed
python -u evaluate_imagenet_patch.py --arch $arch --path $path --patch "adv" --seed $seed
python -u evaluate_imagenet_patch.py --arch $arch --path $path --patch "black" --seed $seed
done