-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_qa_pretrain_t5.sh
executable file
·203 lines (203 loc) · 7.47 KB
/
run_qa_pretrain_t5.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#!/bin/bash
MODE=$1
if [ "$MODE" = "pretrain" ]; then
echo "Pre-train T5 with QA data"
declare -a lrs=("3e-4")
declare -a warms=("100")
for index in ${!lrs[*]};
do
lr=${lrs[$index]}
warm=${warms[$index]}
echo "QA Training - $lr - $warm"
DATA_DIR=qa_data/preprocessed
DST_DATA_DIR=data
CACHED_DATA_DIR=cached_data_20pct
mkdir -p $CACHED_DATA_DIR
MODEL_DIR=saved_models_t5_pretrained/kld_t5_20pct
CUDA_VISIBLE_DEVICES=0,1
python run_dst.py \
--task_name vadst \
--model_name_or_path t5-small \
--mode "$MODE" \
--do_train \
--do_eval \
--seed 42 --disable_tqdm False\
--cached_data_dir $CACHED_DATA_DIR \
--train_file ${DATA_DIR}/train.json \
--validation_file ${DATA_DIR}/dev.json \
--test_file ${DST_DATA_DIR}/test_dials.json \
--ontology_file ${DST_DATA_DIR}/ontology.json \
--description_file utils/slot_description.json \
--neg_num 0.4 --neg_context_ratio 0.05 \
--value_distribution True \
--percentage 20 \
--knowledge_fusion initDecoder \
--word_bow_loss 0.5 \
--evaluation_strategy epoch \
--save_strategy epoch \
--load_best_model_at_end \
--save_total_limit 10 \
--metric_for_best_model eval_loss \
--greater_is_better False \
--logging_steps 999999 \
--warmup_steps ${warm} \
--learning_rate ${lr} \
--num_train_epochs 6 \
--max_seq_length 512 \
--output_dir ${MODEL_DIR} \
--per_device_eval_batch_size 32 \
--per_device_train_batch_size 4 \
--gradient_accumulation_steps 32 \
--fp16 --overwrite_output \
--prediction_output "" \
--overwrite_cache
done
elif [ "$MODE" = "pretrain_fusion" ]; then
echo "Pre-train T5 with QA data"
declare -a lrs=("3e-4")
declare -a warms=("100")
for index in ${!lrs[*]};
do
lr=${lrs[$index]}
warm=${warms[$index]}
echo "QA Training - $lr - $warm"
DATA_DIR=qa_data/preprocessed
DST_DATA_DIR=data
CACHED_DATA_DIR=cached_data_20pct
mkdir -p $CACHED_DATA_DIR
MODEL_DIR=saved_models_t5_pretrained/kld_t5_20pct
CUDA_VISIBLE_DEVICES=0,1
python run_dst_fusion.py \
--task_name vadst \
--model_name_or_path t5-small \
--mode "$MODE" \
--do_train \
--do_eval \
--seed 42 --disable_tqdm False\
--cached_data_dir $CACHED_DATA_DIR \
--train_file ${DATA_DIR}/train.json \
--validation_file ${DATA_DIR}/dev.json \
--test_file ${DST_DATA_DIR}/test_dials.json \
--ontology_file ${DST_DATA_DIR}/ontology.json \
--description_file utils/slot_description.json \
--neg_num 0.4 --neg_context_ratio 0.05 \
--value_distribution True \
--percentage 20 \
--knowledge_fusion initDecoder \
--word_bow_loss 0.5 \
--evaluation_strategy epoch \
--save_strategy epoch \
--load_best_model_at_end \
--save_total_limit 10 \
--metric_for_best_model eval_loss \
--greater_is_better False \
--logging_steps 999999 \
--warmup_steps ${warm} \
--learning_rate ${lr} \
--num_train_epochs 6 \
--max_seq_length 512 \
--output_dir ${MODEL_DIR} \
--per_device_eval_batch_size 32 \
--per_device_train_batch_size 4 \
--gradient_accumulation_steps 32 \
--fp16 --overwrite_output \
--prediction_output "" \
--overwrite_cache
done
elif [ "$MODE" = "predict" ]; then
echo "Pre-train the xlmrb with Parallel examples"
declare -a lrs=("1e-4")
declare -a warms=("100")
for index in ${!lrs[*]};
do
lr=${lrs[$index]}
warm=${warms[$index]}
echo "QA Training - $lr - $warm"
DATA_DIR=qa_data/preprocessed
DST_DATA_DIR=data
CACHED_DATA_DIR=cached_data_20pct
mkdir -p $CACHED_DATA_DIR
MODEL_DIR=saved_models_t5_pretrained/kld_t5_20pct
CUDA_VISIBLE_DEVICES=0
python run_dst.py \
--task_name vadst \
--model_name_or_path ${MODEL_DIR} \
--mode "$MODE" \
--do_predict \
--seed 42 --disable_tqdm False\
--cached_data_dir $CACHED_DATA_DIR \
--train_file ${DATA_DIR}/train.json \
--validation_file ${DATA_DIR}/dev.json \
--test_file ${DST_DATA_DIR}/test_dials.json \
--ontology_file ${DST_DATA_DIR}/ontology.json \
--description_file utils/slot_description.json \
--neg_num 0.0 --neg_context_ratio 0.00 \
--value_distribution True \
--percentage 20 \
--knowledge_fusion initDecoder \
--history_turn 8 \
--evaluation_strategy no \
--save_total_limit 5 \
--metric_for_best_model eval_loss \
--greater_is_better False \
--logging_steps 100 \
--max_seq_length 512 \
--output_dir ${MODEL_DIR} \
--per_device_eval_batch_size 32 \
--per_device_train_batch_size 4 \
--gradient_accumulation_steps 128 \
--fp16 --overwrite_output \
--prediction_output results_64 \
--test_type dst \
--overwrite_cache
done
elif [ "$MODE" = "predict_fusion" ]; then
echo "Pre-train the xlmrb with Parallel examples"
declare -a lrs=("1e-4")
declare -a warms=("100")
for index in ${!lrs[*]};
do
lr=${lrs[$index]}
warm=${warms[$index]}
echo "QA Training - $lr - $warm"
DATA_DIR=qa_data/preprocessed
DST_DATA_DIR=data
CACHED_DATA_DIR=cached_data_20pct
mkdir -p $CACHED_DATA_DIR
MODEL_DIR=saved_models_t5_pretrained/kld_t5_20pct
CUDA_VISIBLE_DEVICES=0
python run_dst_fusion.py \
--task_name vadst \
--model_name_or_path ${MODEL_DIR} \
--mode "$MODE" \
--do_predict \
--seed 42 --disable_tqdm False\
--cached_data_dir $CACHED_DATA_DIR \
--train_file ${DATA_DIR}/train.json \
--validation_file ${DATA_DIR}/dev.json \
--test_file ${DST_DATA_DIR}/test_dials.json \
--ontology_file ${DST_DATA_DIR}/ontology.json \
--description_file utils/slot_description.json \
--neg_num 0.0 --neg_context_ratio 0.00 \
--value_distribution True \
--percentage 20 \
--knowledge_fusion initDecoder \
--history_turn 8 \
--evaluation_strategy no \
--save_total_limit 5 \
--metric_for_best_model eval_loss \
--greater_is_better False \
--logging_steps 100 \
--max_seq_length 512 \
--output_dir ${MODEL_DIR} \
--per_device_eval_batch_size 32 \
--per_device_train_batch_size 4 \
--gradient_accumulation_steps 128 \
--fp16 --overwrite_output \
--prediction_output results_64 \
--test_type dst \
--overwrite_cache
done
else
echo "Wrong Mode"
fi