-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_exps.sh
executable file
·137 lines (128 loc) · 3.58 KB
/
run_exps.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
# Controlling params
setting=$1 #dst, c2t, or e2e
stage=$2 #to select training, test, and eval stage
small_data=$3 # for debugging purpose, only training for 3 epochs, use small sized data only
version=$4 # 2.0 or 2.1
# Data params
prefix="updated_"
max_dial_his_len=1
detach_dial_his=1
add_prev_dial_state=1
num_workers=4
# Model params
model=tf
sys_act=1
nb_blocks_res_dec=3
nb_blocks_slot_dst=3
nb_blocks_domain_dst=3
nb_blocks_domain_slot_dst=0
d_model=256
d_ff=$(( d_model*4 ))
att_h=8
dropout=0.3
# Training params
out_directory=exps
batch_size=32
warmup_steps=10000
if [ $small_data -eq 1 ]; then
epochs=3
out_directory=${out_directory}_small
else
epochs=30
fi
# Pretrained model
pretrained_dst=${out_directory}/multiwoz${version}_dst/${model}_best.pth.tar
# output directory
out_dir=${out_directory}/multiwoz${version}_${setting}
if [ $stage -le 1 ]; then
python train.py \
--out-dir $out_dir \
--data-version $version \
--small-data $small_data \
--num-workers $num_workers \
--prefix $prefix \
--model $model \
--warmup-steps $warmup_steps \
--dropout $dropout \
--num-epochs $epochs \
--batch-size $batch_size \
--detach-dial-his $detach_dial_his \
--add-prev-dial-state $add_prev_dial_state \
--max-dial-his-len $max_dial_his_len \
--setting $setting \
--nb-blocks-slot-dst $nb_blocks_slot_dst \
--nb-blocks-domain-dst $nb_blocks_domain_dst \
--nb-blocks-domain-slot-dst $nb_blocks_domain_slot_dst \
--nb-blocks-res-dec $nb_blocks_res_dec \
--d-model $d_model \
--d-ff $d_ff \
--att-h $att_h \
--pretrained-dst $pretrained_dst \
--sys-act $sys_act
fi
#testing params
tep='best'
dst_max_len=10
res_max_len=20
res_min_len=1
beam=5
penalty=1.0
nbest=5
gt_db_pointer=0
gt_previous_bs=0
if [ "$setting" = "c2t" ]; then
gt_db_pointer=1
gt_previous_bs=1
fi
output=output_gtpointer${gt_db_pointer}_gtprevbs${gt_previous_bs}_ep${tep}.json
if [ $stage -le 2 ]; then
python generate.py \
--out-dir $out_dir \
--model $model \
--dst-max-len $dst_max_len \
--res-max-len $res_max_len \
--res-min-len $res_min_len \
--beam $beam \
--penalty $penalty \
--nbest $nbest \
--output $output \
--gt-db-pointer $gt_db_pointer \
--gt-previous-bs $gt_previous_bs \
--small-data $small_data \
--tep $tep \
--verbose 0
fi
if [ $stage -le 3 ]; then
if [ "$setting" != "c2t" ]; then
python dst_evaluate.py \
--out-dir $out_dir \
--model $model \
--dst-max-len $dst_max_len \
--res-max-len $res_max_len \
--res-min-len $res_min_len \
--beam $beam \
--penalty $penalty \
--nbest $nbest \
--output $output \
--gt-db-pointer $gt_db_pointer \
--gt-previous-bs $gt_previous_bs \
--small-data $small_data \
--tep $tep
fi
if [ "$setting" != "dst" ]; then
python c2t_evaluate.py \
--out-dir $out_dir \
--model $model \
--dst-max-len $dst_max_len \
--res-max-len $res_max_len \
--res-min-len $res_min_len \
--beam $beam \
--penalty $penalty \
--nbest $nbest \
--output $output \
--gt-db-pointer $gt_db_pointer \
--gt-previous-bs $gt_previous_bs \
--small-data $small_data \
--tep $tep
fi
fi