/
run_knowledge_medical_text_match.sh
75 lines (64 loc) · 2.11 KB
/
run_knowledge_medical_text_match.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
#!/bin/bash
set -e
if [ $# -lt 0 ]; then
export CUDA_VISIBLE_DEVICES=$1
fi
WORKER_COUNT=1
WORKER_GPU=1
if [ ! -f ./nlu_train.csv ]; then
wget https://atp-modelzoo-sh.oss-cn-shanghai.aliyuncs.com/release/tutorials/knowledge_nlu/nlu_train.csv
fi
if [ ! -f ./nlu_dev.csv ]; then
wget https://atp-modelzoo-sh.oss-cn-shanghai.aliyuncs.com/release/tutorials/knowledge_nlu/nlu_dev.csv
fi
echo '=========[ Training: Medical Text Matching ]========='
easynlp \
--mode=train \
--worker_count=${WORKER_COUNT} \
--worker_gpu=${WORKER_GPU} \
--tables=nlu_train.csv,nlu_dev.csv \
--input_schema=label:str:1,text1:str:1,text2:str:1 \
--first_sequence=text1 \
--second_sequence=text2 \
--label_name=label \
--label_enumerate_values=0,1 \
--checkpoint_dir=./medical_model \
--learning_rate=3e-5 \
--epoch_num=1 \
--random_seed=42 \
--save_checkpoint_steps=50 \
--sequence_length=128 \
--micro_batch_size=32 \
--app_name=text_match \
--user_defined_parameters="pretrain_model_name_or_path=alibaba-pai/pai-dkplm-medical-base-zh"
echo '=========[ Evaluation: Medical Text Matching ]========='
easynlp \
--mode=evaluate \
--worker_count=${WORKER_COUNT} \
--worker_gpu=${WORKER_GPU} \
--tables=nlu_dev.csv \
--input_schema=label:str:1,text1:str:1,text2:str:1 \
--first_sequence=text1 \
--second_sequence=text2 \
--label_name=label \
--label_enumerate_values=0,1 \
--checkpoint_dir=./medical_model \
--sequence_length=128 \
--micro_batch_size=32 \
--app_name=text_match
echo '=========[ Prediction: Medical Text Matching ]========='
easynlp \
--mode=predict \
--worker_count=${WORKER_COUNT} \
--worker_gpu=${WORKER_GPU} \
--tables=nlu_dev.csv \
--outputs=nlu_dev.pred.csv \
--input_schema=label:str:1,text1:str:1,text2:str:1 \
--output_schema=predictions \
--append_cols=text1,text2,label \
--first_sequence=text1 \
--second_sequence=text2 \
--checkpoint_dir=./medical_model \
--micro_batch_size=32 \
--sequence_length=128 \
--app_name=text_match