-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·187 lines (174 loc) · 5.97 KB
/
run.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/usr/bin/bash
DOWNSAMPLING_FACTORS="1 3 9 27 81 243"
REPLIDS="a b c"
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
SCRIPTPATH=$(readlink -f "$0")
SCRIPTDIR=$(dirname "$SCRIPTPATH")
run_experiment() {
expdir=$1
cd $expdir
git rev-parse HEAD >commit.txt
python run.py >run.log 2>&1
cd - >/dev/null
}
clean() {
expdir=$1
exptype=$2
if [ "$exptype" != "" ]; then
python $SCRIPTDIR/../../utils/copy_best.py --experiment_type $exptype $expdir
fi
rm $expdir/net.?.pt $expdir/net.??.pt
}
run_downsampling() {
expname=$1
exptype=$2
for df in $DOWNSAMPLING_FACTORS; do
dftag=ds$(printf %03d $df)
for rid in $REPLIDS; do
expdir=runs/$expname-$dftag-$rid-$TIMESTAMP
mkdir -p $expdir
cp $expname.py $expdir/run.py
cp conf/seed-$rid.yml $expdir/config.yml
echo -e "downsampling_factor\t$df" >> $expdir/config.yml
if [[ $expname == pip* ]]; then
path_asr=$(ls -d runs/asr-$dftag-$rid-* | xargs basename)
echo -e "asr_model_dir\t../$path_asr" >> $expdir/config.yml
if [ $expname == pip-ind ]; then
path_ti=$(ls -d runs/text-image-$dftag-$rid-* | xargs basename)
echo -e "text_image_model_dir\t../$path_ti" >> $expdir/config.yml
fi
fi
run_experiment $expdir
clean $expdir $exptype
done
done
}
run_downsampling_jp() {
expname=$1
exptype=$2
for df in $DOWNSAMPLING_FACTORS; do
dftag=ds$(printf %03d $df)
for rid in $REPLIDS; do
expdir=runs/$expname-jp-$dftag-$rid-$TIMESTAMP
mkdir -p $expdir
cp $expname/run.py $expdir
cat conf/jp_human.yml conf/seed-$rid.yml > $expdir/config.yml
echo -e "downsampling_factor\t$df" >> $expdir/config.yml
if [[ $expname == pip* ]]; then
path_asr=$(ls -d runs/asr-jp-$dftag-$rid-* | xargs basename)
echo -e "asr_model_dir\t../$path_asr" >> $expdir/config.yml
if [ $expname == pip-ind ]; then
path_ti=$(ls -d runs/text-image-jp-$dftag-$rid-* | xargs basename)
echo -e "text_image_model_dir\t../$path_ti" >> $expdir/config.yml
fi
fi
run_experiment $expdir
clean $expdir $exptype
done
done
}
run_downsampling_text() {
expname=$1
exptype=$2
for df in $DOWNSAMPLING_FACTORS; do
dftag=ds$(printf %03d $df)
for rid in $REPLIDS; do
expdir=runs/$expname-$dftag-$rid-$TIMESTAMP
mkdir -p $expdir
cp $expname/run.py $expdir
cp conf/seed-$rid.yml $expdir/config.yml
echo -e "downsampling_factor_text\t$df" >> $expdir/config.yml
if [[ $expname == pip* ]]; then
path_asr=$(ls -d runs/asr-$dftag-$rid-* | xargs basename)
echo -e "asr_model_dir\t../$path_asr" >> $expdir/config.yml
if [ $expname == pip-ind ]; then
path_ti=$(ls -d runs/text-image-$dftag-$rid-* | xargs basename)
echo -e "text_image_model_dir\t../$path_ti" >> $expdir/config.yml
fi
fi
run_experiment $expdir
clean $expdir $exptype
done
done
}
run_downsampling_text_jp() {
expname=$1
exptype=$2
for df in $DOWNSAMPLING_FACTORS; do
dftag=ds$(printf %03d $df)
for rid in $REPLIDS; do
expdir=runs/$expname-jp-$dftag-$rid-$TIMESTAMP
mkdir -p $expdir
cp $expname/run.py $expdir
cat conf/jp_human.yml conf/seed-$rid.yml > $expdir/config.yml
echo -e "downsampling_factor_text\t$df" >> $expdir/config.yml
if [[ $expname == pip* ]]; then
path_asr=$(ls -d runs/asr-jp-$dftag-$rid-* | xargs basename)
echo -e "asr_model_dir\t../$path_asr" >> $expdir/config.yml
if [ $expname == pip-ind ]; then
path_ti=$(ls -d runs/text-image-jp-$dftag-$rid-* | xargs basename)
echo -e "text_image_model_dir\t../$path_ti" >> $expdir/config.yml
fi
fi
run_experiment $expdir
clean $expdir $exptype
done
done
}
replicate() {
expname=$1
exptype=$2
tag=$3
[ "$tag" != "" ] && tag=-$tag
for rid in $REPLIDS; do
expdir=runs/$expname$tag-$rid-$TIMESTAMP
mkdir -p $expdir
cp $expname/run.py $expdir
cp conf/seed-$rid.yml $expdir/config.yml
if [ "$tag" == "-comp" ]; then
echo -e "flickr8k_meta\tdataset_multilingual_human_only.json" >> $expdir/config.yml
fi
run_experiment $expdir
clean $expdir $exptype
done
}
rerun() {
expname=$1
exptype=$2
tag=$3
[ "$tag" != "" ] && tag=-$tag
for df in $DOWNSAMPLING_FACTORS; do
dftag=ds$(printf %03d $df)
for rid in $REPLIDS; do
expdir=$(ls -d runs/$expname$tag-$dftag-$rid-* | xargs basename)
expdir=runs/$expdir
run_experiment $expdir
clean $expdir $exptype
done
done
}
# Experiments with transcriptions
run_downsampling asr asr
replicate basic-default retrieval
run_downsampling text-image retrieval
run_downsampling_text mtl-asr mtl
run_downsampling_text mtl-st mtl
run_downsampling pip-ind
run_downsampling_text pip-seq
# Experiments with translations
run_downsampling_jp asr slt
replicate basic-default retrieval jp
run_downsampling_jp text-image retrieval
run_downsampling_text_jp mtl-asr mtl
run_downsampling_text_jp mtl-st mtl
run_downsampling_jp pip-ind
run_downsampling_text_jp pip-seq
# Experiments with transcriptions, matching size of Japanese dataset
replicate asr asr comp
replicate basic-default retrieval comp
replicate text-image retrieval comp
replicate mtl-asr mtl comp
replicate mtl-st mtl comp
replicate pip-ind "" comp
replicate pip-seq "" comp
echo "Finished."