-
Notifications
You must be signed in to change notification settings - Fork 5
/
run_nlu.sh
97 lines (90 loc) · 2.29 KB
/
run_nlu.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
for i in "$@"
do
case $i in
-g=*|--gpudevice=*)
GPUDEVICE="${i#*=}"
shift
;;
-t=*|--taskname=*)
TASKNAME="${i#*=}"
shift
;;
-r=*|--randomseed=*)
RANDOMSEED="${i#*=}"
shift
;;
-p=*|--predicttag=*)
PREDICTTAG="${i#*=}"
shift
;;
-m=*|--modeldir=*)
MODELDIR="${i#*=}"
shift
;;
-d=*|--datadir=*)
DATADIR="${i#*=}"
shift
;;
-o=*|--outputdir=*)
OUTPUTDIR="${i#*=}"
shift
;;
--maxlen=*)
MAXLEN="${i#*=}"
shift
;;
--batchsize=*)
BATCHSIZE="${i#*=}"
shift
;;
--learningrate=*)
LEARNINGRATE="${i#*=}"
shift
;;
--trainepochs=*)
TRAINEPOCHS="${i#*=}"
shift
;;
esac
done
echo "gpu device = ${GPUDEVICE}"
echo "task name = ${TASKNAME}"
echo "random seed = ${RANDOMSEED}"
echo "predict tag = ${PREDICTTAG}"
echo "model dir = ${MODELDIR}"
echo "data dir = ${DATADIR}"
echo "output dir = ${OUTPUTDIR}"
echo "max len = ${MAXLEN}"
echo "batch size = ${BATCHSIZE}"
echo "learning rate = ${LEARNINGRATE}"
echo "train epochs = ${TRAINEPOCHS}"
alias python=python3
CUDA_VISIBLE_DEVICES=${GPUDEVICE} python run_nlu.py \
--bert_config_file=${MODELDIR}/bert_config.json \
--init_checkpoint=${MODELDIR}/bert_model.ckpt \
--vocab_file=${MODELDIR}/vocab.txt \
--task_name=${TASKNAME} \
--random_seed=${RANDOMSEED} \
--predict_tag=${PREDICTTAG} \
--do_lower_case=false \
--data_dir=${DATADIR}/ \
--output_dir=${OUTPUTDIR}/debug \
--export_dir=${OUTPUTDIR}/export \
--max_seq_length=${MAXLEN} \
--train_batch_size=${BATCHSIZE} \
--learning_rate=${LEARNINGRATE} \
--num_train_epochs=${TRAINEPOCHS} \
--do_train=true \
--do_eval=false \
--do_predict=true \
--do_export=false
python tool/eval_sent.py \
--input_file=${OUTPUTDIR}/debug/predict.${PREDICTTAG}.json \
--output_file=${OUTPUTDIR}/debug/predict.${PREDICTTAG}.sent
python tool/convert_token.py \
--input_file=${OUTPUTDIR}/debug/predict.${PREDICTTAG}.json \
--output_file=${OUTPUTDIR}/debug/predict.${PREDICTTAG}.txt
python tool/eval_token.py \
< ${OUTPUTDIR}/debug/predict.${PREDICTTAG}.txt \
> ${OUTPUTDIR}/debug/predict.${PREDICTTAG}.token
read -n 1 -s -r -p "Press any key to continue..."