forked from polyusmart/Doctor-Recommendation
-
Notifications
You must be signed in to change notification settings - Fork 1
/
train.sh
51 lines (48 loc) · 1.56 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
gpu_id=0
n_gpu=8
for seed in 131 725 1104
do
for name in mul_att_full mul_att_wo_d mul_att_wo_p mul_att_wo_sl
do
echo "randome seed: ${seed}, experiment name: ${name}, run on gpu ${gpu_id}"
output_dir="output/seed_${seed}/${name}"
if [[ ! -d $output_dir ]]
then
echo "${output_dir} does not exist, mkdir."
mkdir -p $output_dir
mkdir -p $output_dir/ckpt
fi
if [[ ! -d $output_dir/ckpt ]]
then
mkdir -p $output_dir/ckpt
fi
# change exp settings here,
# corresponding arguments are in utils/config.py
if [[ "${name}" == "mul_att_full" ]]
then
embeddings_path=bert_embeddings
add_self_att_on="none"
elif [[ "${name}" == "mul_att_wo_d" ]]
then
embeddings_path=bert_embeddings
add_self_att_on="profile"
elif [[ "${name}" == "mul_att_wo_p" ]]
then
embeddings_path=bert_embeddings
add_self_att_on="dialogs"
elif [[ "${name}" == "mul_att_wo_sl" ]]
then
embeddings_path=bert_embeddings_wo_sl
add_self_att_on="none"
fi
echo "${name} training start!"
nohup python -u train.py \
-seed $seed \
-gpu $gpu_id \
-name $name \
-embeddings_path $embeddings_path \
-add_self_att_on $add_self_att_on \
-output_dir $output_dir > ${name}_seed${seed}_training.log 2>&1 &
gpu_id=$(( ($gpu_id + 1) % $n_gpu))
done
done