This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathreplicate_results_iclr19.sh
executable file
·125 lines (119 loc) · 4.33 KB
/
replicate_results_iclr19.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
#! /bin/bash
# Usage ./replicate_results.sh <DATASET-NAME> <THREAD-ID> <JE>
## where <DATASET-NAME>: MNIST, CIFAR, CUB, AWA
DATASET=$1
THREAD=$2
JE=$3
OPTIM='SGD'
BATCH_SIZE=10
if [ $DATASET = "MNIST" ]; then
NUM_RUNS=5
if [ $THREAD = 1 ]; then
IMP_METHODS=( 'VAN' 'EWC' 'PI' )
LRS=(0.03 0.03 0.1)
LAMDAS=(0 10 0.1)
elif [ $THREAD = 2 ]; then
IMP_METHODS=( 'MAS' 'RWALK' )
LRS=(0.1 0.1)
LAMDAS=(0.1 1)
elif [ $THREAD = 3 ]; then
IMP_METHODS=( 'PNN' 'A-GEM' )
LRS=(0.1 0.1)
LAMDAS=(0 0)
fi
ARCH='FC-S'
RESULTS_DIR='results/mnist'
if [ ! -d $RESULTS_DIR ]; then
mkdir -pv $RESULTS_DIR
fi
for ((i=0;i<${#IMP_METHODS[@]};++i)); do
imp_method="${IMP_METHODS[i]}"
lr=${LRS[i]}
lam=${LAMDAS[i]}
python ./fc_permute_mnist.py --train-single-epoch --arch $ARCH --num-runs $NUM_RUNS --batch-size $BATCH_SIZE --optim $OPTIM --learning-rate $lr --imp-method $imp_method --synap-stgth $lam --log-dir $RESULTS_DIR
done
elif [ $DATASET = "CIFAR" ]; then
NUM_RUNS=5
if [ $THREAD = 1 ]; then
IMP_METHODS=( 'VAN' 'EWC' 'PI' )
LRS=(0.01 0.03 0.01)
LAMDAS=(0 10 0.1)
elif [ $THREAD = 2 ]; then
IMP_METHODS=( 'MAS' 'RWALK' )
LRS=(0.03 0.03)
LAMDAS=(0.1 1)
elif [ $THREAD = 3 ]; then
IMP_METHODS=( 'PNN' 'A-GEM' )
LRS=(0.03 0.03)
LAMDAS=(0 0)
fi
ARCH='RESNET-S'
RESULTS_DIR='results/cifar'
if [ ! -d $RESULTS_DIR ]; then
mkdir -pv $RESULTS_DIR
fi
for ((i=0;i<${#IMP_METHODS[@]};++i)); do
imp_method="${IMP_METHODS[i]}"
lr=${LRS[i]}
lam=${LAMDAS[i]}
python ./conv_split_cifar.py --train-single-epoch --arch $ARCH --num-runs $NUM_RUNS --batch-size $BATCH_SIZE --optim $OPTIM --learning-rate $lr --imp-method $imp_method --synap-stgth $lam --log-dir $RESULTS_DIR
done
elif [ $DATASET = "CUB" ]; then
NUM_RUNS=10
if [ $THREAD = 1 ]; then
IMP_METHODS=( 'VAN' 'EWC' )
elif [ $THREAD = 2 ]; then
IMP_METHODS=( 'PI' 'MAS' )
elif [ $THREAD = 3 ]; then
IMP_METHODS=( 'RWALK' 'A-GEM' )
fi
ARCH='RESNET-B'
OHOT_RESULTS_DIR='results/cub/ohot'
JE_RESULTS_DIR='results/cub/je'
if [ ! -d $OHOT_RESULTS_DIR ]; then
mkdir -pv $OHOT_RESULTS_DIR
fi
if [ ! -d $JE_RESULTS_DIR ]; then
mkdir -pv $JE_RESULTS_DIR
fi
for ((i=0;i<${#IMP_METHODS[@]};++i)); do
imp_method="${IMP_METHODS[i]}"
if [ $JE = 0 ]; then
python conv_split_cub.py --train-single-epoch --arch $ARCH --num-runs $NUM_RUNS --batch-size $BATCH_SIZE --optim $OPTIM --imp-method $imp_method --data-dir ./CUB_data/CUB_200_2011/images/ --log-dir $OHOT_RESULTS_DIR
elif [ $JE = 1 ]; then
python conv_split_cub_hybrid.py --train-single-epoch --arch $ARCH --num-runs $NUM_RUNS --batch-size $BATCH_SIZE --optim $OPTIM --imp-method $imp_method --data-dir ./CUB_data/CUB_200_2011/images/ --log-dir $JE_RESULTS_DIR
fi
done
elif [ $DATASET = "AWA" ]; then
NUM_RUNS=10
if [ $THREAD = 1 ]; then
IMP_METHODS=( 'VAN' )
elif [ $THREAD = 2 ]; then
IMP_METHODS=( 'EWC' )
elif [ $THREAD = 3 ]; then
IMP_METHODS=( 'PI' )
elif [ $THREAD = 4 ]; then
IMP_METHODS=( 'RWALK' )
elif [ $THREAD = 5 ]; then
IMP_METHODS=( 'A-GEM' )
fi
ARCH='RESNET-B'
OHOT_RESULTS_DIR='results/awa/ohot'
JE_RESULTS_DIR='results/awa/je'
if [ ! -d $OHOT_RESULTS_DIR ]; then
mkdir -pv $OHOT_RESULTS_DIR
fi
if [ ! -d $JE_RESULTS_DIR ]; then
mkdir -pv $JE_RESULTS_DIR
fi
for ((i=0;i<${#IMP_METHODS[@]};++i)); do
imp_method="${IMP_METHODS[i]}"
if [ $JE = 0 ]; then
python conv_split_awa.py --train-single-epoch --arch $ARCH --num-runs $NUM_RUNS --batch-size $BATCH_SIZE --optim $OPTIM --imp-method $imp_method --data-dir ./AWA_data/Animals_with_Attributes2/ --log-dir $OHOT_RESULTS_DIR
elif [ $JE = 1 ]; then
python conv_split_awa_hybrid.py --train-single-epoch --arch $ARCH --num-runs $NUM_RUNS --batch-size $BATCH_SIZE --optim $OPTIM --imp-method $imp_method --data-dir ./AWA_data/Animals_with_Attributes2/ --log-dir $JE_RESULTS_DIR
fi
done
fi