forked from PaddlePaddle/PaddleNLP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_classifier.sh
53 lines (51 loc) · 2.05 KB
/
run_classifier.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
data_dir=${1}
conf_path=${2}
ckpt_dir=${3}
predict_data=${4}
learning_rate=${5}
is_train=${6}
max_seq_len=${7}
batch_size=${8}
epoch=${9}
pred_save_path=${10}
if [ "$is_train" = True ]; then
unset CUDA_VISIBLE_DEVICES
python -m paddle.distributed.launch --gpus "0" classifier.py \
--num_epoch ${epoch} \
--learning_rate 5e-5 \
--tag_path ${conf_path} \
--train_data ${data_dir}/train.tsv \
--dev_data ${data_dir}/dev.tsv \
--test_data ${data_dir}/test.tsv \
--predict_data ${predict_data} \
--do_train True \
--do_predict False \
--max_seq_len ${max_seq_len} \
--batch_size ${batch_size} \
--skip_step 1 \
--valid_step 5 \
--checkpoints ${ckpt_dir} \
--init_ckpt ${ckpt_dir}/best.pdparams \
--predict_save_path ${pred_save_path} \
--device gpu
else
export CUDA_VISIBLE_DEVICES=0
python classifier.py \
--num_epoch ${epoch} \
--learning_rate 5e-5 \
--tag_path ${conf_path} \
--train_data ${data_dir}/train.tsv \
--dev_data ${data_dir}/dev.tsv \
--test_data ${data_dir}/test.tsv \
--predict_data ${predict_data} \
--do_train False \
--do_predict True \
--max_seq_len ${max_seq_len} \
--batch_size ${batch_size} \
--skip_step 1 \
--valid_step 1 \
--checkpoints ${ckpt_dir} \
--init_ckpt ${ckpt_dir}/best.pdparams \
--predict_save_path ${pred_save_path} \
--device gpu
fi