-
Notifications
You must be signed in to change notification settings - Fork 0
/
train.sh
81 lines (63 loc) · 2.01 KB
/
train.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
export CUBLAS_WORKSPACE_CONFIG=:16:8
############### Host ##############################
HOST=$(hostname)
echo "Current host is: $HOST"
DATE=`date +%Y-%m-%d`
echo $DATE
DIRECTORY=./save/${DATE}/
if [ ! -d "./save" ]; then
mkdir ./save
fi
if [ ! -d "$DIRECTORY" ]; then
mkdir ./save/${DATE}/
fi
############### Configuration ##############################
epoch=200
STEP=100
RANDOM_SEED=10
DATA_ROOT='./dataset' #YOUR DATASET ROOT
if [ ! -d "$DATA_ROOT" ]; then
mkdir $DATA_ROOT
fi
DATASET='cifar10'
# DATASET='svhn'
# DATASET='gtsrb'
if [ ! -d "./$DATA_ROOT/$DATASET" ]; then
mkdir ./$DATA_ROOT/$DATASET
fi
############### Train ##############################
# ----- IP vendor: Train biased models -----
echo "train model for IP vendor"
# train models
MODEL='MobileNet'
# MODEL='resnet18'
# MODEL='ShuffleNetG2'
# log path
save_path=save/${DATE}/${DATASET}_${MODEL}
# To train model A
python train_classifier.py --dataset ${DATASET} \
--model ${MODEL} \
--n_epochs ${epoch} \
--data_root ${DATA_ROOT} \
--manualSeed ${RANDOM_SEED} \
--save_path ${save_path} \
--class_weight 0
wait
# To train model B
python train_classifier.py --dataset ${DATASET} \
--model ${MODEL} \
--n_epochs ${epoch} \
--data_root ${DATA_ROOT} \
--manualSeed ${RANDOM_SEED} \
--save_path ${save_path} \
--class_weight 1
wait
# To train model C
python train_classifier.py --dataset ${DATASET} \
--model ${MODEL} \
--n_epochs ${epoch} \
--data_root ${DATA_ROOT} \
--manualSeed ${RANDOM_SEED} \
--save_path ${save_path} \
--class_weight 2
wait