-
Notifications
You must be signed in to change notification settings - Fork 3
/
weight.sh
executable file
·107 lines (96 loc) · 3.01 KB
/
weight.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
#!/bin/bash
print_help() {
echo -e "Usage: $0 <network> <size>"
echo -e ""
echo -e "<network> options: alexnet, dbn, mlp, resnet, vgg"
echo -e "<size> options: large, medium, small"
exit 0
}
if [[ "$#" -lt 2 || $1 = '-h' || $1 = '--help' ]]; then
print_help
fi
### Default arguments ###
# Read lowercase of network type.
network=${1,,}; shift
# Read lowercase of size options.
size=${1,,}; shift
### Concatenate size option to network type.
if [[ $size = 'large' ]]; then
network+=_large
elif [[ $size = 'medium' ]]; then
network+=_medium
elif [[ $size = 'small' ]]; then
network+=_small
else
echo -e "Error : Wrong size option $size"
exit 1
fi
# Nebula main directory
nebuladir=$PWD
# Benchmark directory
benchdir=$PWD/benchmarks/$network
##### Translate google drive ID of Nebula benchmark #####
weight_ID() {
case $1 in
lenet )
FILEID="1i1FvFqeyjlTAqyh0Dji9FUo97uhbFXxR" ;;
alexnet_large )
FILEID="1CJyYVci0vgjZAf3kl_i1_VJaowFkZ6qV" ;;
alexnet_medium )
FILEID="1MYFsiV-LHt4sK-OumUlbfWooOcsFze7Y" ;;
alexnet_small )
FILEID="1fjJPJnJ914w8BsS7yDe-m9Cre3KZVOZi" ;;
vgg_large )
FILEID="1IfKa3pgt5W9kMtj1OVeuV1bNW4jfxhlD" ;;
vgg_medium )
FILEID="19gUDTtHQInK12y0PUgyOPtxomkwlLJhl" ;;
vgg_small )
FILEID="1L6GzG0Je43jd6sVWICFC8oCVEtP507ee" ;;
mlp_large )
FILEID="1l8POYfrLT2ZEIRbljt-7ub7-dXpEA1l2" ;;
mlp_medium )
FILEID="1Re0I0q0_ngt2NRcAd22AQthpxCtoeTi6" ;;
mlp_small )
FILEID="1Rvx5gzy-ActdGjHWWiz5uJTfV5AD-oQ_" ;;
dbn_large )
FILEID="1b1Fhhxsn4SRTmjLtii6Bxmjh_i71bZmr" ;;
dbn_medium )
FILEID="1dertTo4oNPxb8u4I3RVP9g1absIyAV78" ;;
dbn_small )
FILEID="1eT8bN0DPPtQNLumF92IEHQI31vTLV9gx" ;;
resnet_large )
FILEID="1XYuSRsPm1HlDXQRLtvTx9sVmXbgXTCG2" ;;
resnet_medium )
FILEID="1KzzvRJkYE4Qu5n7kjwBwbfKyAYYbROui" ;;
resnet_small )
FILEID="1DlERgUr2dOPZbPUP16EZ7y2EWjxR0Qy5" ;;
rnn_large )
echo -e "Does not support weight file of $1"
exit 1 ;;
rnn_medium )
echo -e "Does not support weight file of $1"
exit 1 ;;
rnn_small )
echo -e "Does not support weight file of $1"
exit 1 ;;
lstm_large )
echo -e "Does not support weight file of $1"
exit 1 ;;
lstm_medium )
echo -e "Does not support weight file of $1"
exit 1 ;;
lstm_small )
echo -e "Does not support weight file of $1"
exit 1 ;;
* )
echo -e "Error: unsupported weight"
exit 1
esac
}
# Get google drive ID of nebula benchmark target.
weight_ID $network
# Download Nebula benchmark weight from google drive.
# store the weight to each benchmark directory with the name of <input.wgh>.
cd $benchdir
# Get weight from google drive.
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$FILEID" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=$FILEID" -O input.wgh && rm -rf /tmp/cookies.txt