-
Notifications
You must be signed in to change notification settings - Fork 9
/
run_all_experiments
executable file
·54 lines (46 loc) · 1.6 KB
/
run_all_experiments
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
#!/usr/bin/env bash
# Pass a seed as the sole argument
# This'll be passed through to the configs, where it's used
# in data iteration and in Pytorch internals
seed=0
if [[ $# == 1 ]]; then
seed=$1
fi
# Catch misspecified out directory early
if [[ -n "${OUT_DIR}" && -d "${OUT_DIR}" ]]; then
echo "${OUT_DIR} already exists"
exit 1
fi
mkdir -p "${OUT_DIR}"
function run_with_data {
local data="$1"
local test_data="$2"
if [[ -z "${test_data}" ]]; then
# Default to the folder's test data
test_data="data/${data}/test.txt"
fi
local results_dir="experiments/results_${data}"
bash -c "sleep 10; tensorboard serve --logdir ${results_dir} --bind_all --port 6008" &
./scripts/train_all_models "${data}" experiments -t "data/${data}/train.txt" -v "data/${data}/val.txt"
./scripts/test_all_models "${results_dir}" "${test_data}"
pkill tensorboard
# Model archives can take up a lot of space. Use OUT_DIR to move them elsewhere
if [[ -n "${OUT_DIR}" ]]; then
set -x;
mv -b --suffix=.bak "${results_dir}" "${OUT_DIR}"
set -x;
fi
}
export SEED=$seed
# Column 1
run_with_data gen
run_with_data gen_logical
# Column 2 (train on gen data, test on the standard paraphrase test set)
./scripts/test_all_models "experiments/results_gen" "data/para/test.txt"
./scripts/test_all_models "experiments/results_gen_logical" "data/para_logical/test.txt"
# Column 3
run_with_data para
run_with_data para_logical
# Column 4 (both gen and real data, but test on para only!)
run_with_data all "data/para/test.txt"
run_with_data all_logical "data/para_logical/test.txt"