model_compression.sh 1.97 KB
Newer Older
chicm-ms's avatar
chicm-ms committed
1
2
3
4
5
6
7
8
#!/bin/bash
set -e
CWD=${PWD}

echo ""
echo "===========================Testing: pruning and speedup==========================="
cd ${CWD}/../examples/model_compress

J-shang's avatar
J-shang committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
echo "testing fpgm pruning and speedup..."
python3 pruning/basic_pruners_torch.py --pruner fpgm --pretrain-epochs 1 --fine-tune-epochs 1 --model vgg16 --dataset cifar10
python3 pruning/model_speedup.py --example_name fpgm

echo "testing slim pruning and speedup..."
python3 pruning/basic_pruners_torch.py --pruner slim --pretrain-epochs 1 --fine-tune-epochs 1 --model vgg19 --dataset cifar10 --sparsity 0.7
python3 pruning/model_speedup.py --example_name slim

echo "testing l1filter pruning and speedup..."
python3 pruning/basic_pruners_torch.py --pruner l1filter --pretrain-epochs 1 --fine-tune-epochs 1 --model vgg16 --dataset cifar10
python3 pruning/model_speedup.py --example_name l1filter

echo "testing apoz pruning and speedup..."
python3 pruning/basic_pruners_torch.py --pruner apoz --pretrain-epochs 1 --fine-tune-epochs 1 --model vgg16 --dataset cifar10
python3 pruning/model_speedup.py --example_name apoz
chicm-ms's avatar
chicm-ms committed
24

chicm-ms's avatar
chicm-ms committed
25
echo 'testing level pruner pruning'
J-shang's avatar
J-shang committed
26
python3 pruning/basic_pruners_torch.py --pruner level --pretrain-epochs 1 --fine-tune-epochs 1 --model lenet --dataset mnist
chicm-ms's avatar
chicm-ms committed
27
28

echo 'testing agp pruning'
J-shang's avatar
J-shang committed
29
python3 pruning/basic_pruners_torch.py --pruner agp --pretrain-epochs 1 --fine-tune-epochs 1 --model lenet --dataset mnist
chicm-ms's avatar
chicm-ms committed
30
31

echo 'testing mean_activation pruning'
J-shang's avatar
J-shang committed
32
python3 pruning/basic_pruners_torch.py --pruner mean_activation --pretrain-epochs 1 --fine-tune-epochs 1 --model vgg16 --dataset cifar10
chicm-ms's avatar
chicm-ms committed
33

34
echo "testing lottery ticket pruning..."
J-shang's avatar
J-shang committed
35
python3 pruning/lottery_torch_mnist_fc.py --train_epochs 1
chicm-ms's avatar
chicm-ms committed
36
37
38
39
40
41
42
43
44
45
46
47
48

echo ""
echo "===========================Testing: quantizers==========================="
# to be enabled
#echo "testing QAT quantizer..."
#python3 QAT_torch_quantizer.py

#echo "testing DoReFa quantizer..."
#python3 DoReFaQuantizer_torch_mnist.py

#echo "testing BNN quantizer..."
#python3 BNN_quantizer_cifar10.py

J-shang's avatar
J-shang committed
49
rm -rf ./experiment_data/*