-
Notifications
You must be signed in to change notification settings - Fork 0
/
eval.sh
57 lines (51 loc) · 1.68 KB
/
eval.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
export PYTHONPATH="./:${PYTHONPATH}"
export CUDA_VISIBLE_DEVICES=5
PRETRAINED_DIR="./models/pretrained_dorm"
DATE_DIR="data"
index=1
learning_rate=75e-6
pinyin_weight=0.2
add_pinyin_mask="True"
add_pinyin_loss="True"
use_kl="True"
kl_weight=1.5
second_loss_weight=0.97
gradient_accumulation_steps=1
random_seed=42
OUTPUT_DIR="./models/sota_dorm"
for year in {13..15}
do
python -m torch.distributed.launch --master_port=24679 --nproc_per_node=1 src/dorm_finetune.py \
--model_type dorm \
--model_name_or_path $PRETRAINED_DIR \
--image_model_type 0 \
--output_dir $OUTPUT_DIR \
--do_eval --do_predict \
--data_dir $DATE_DIR \
--train_file trainall.times2_pinyin2.pkl \
--dev_file "test.sighan${year}_pinyin2.pkl" \
--dev_label_file "test.sighan${year}.lbl.tsv" \
--predict_file "test.sighan${year}_pinyin2.pkl" \
--predict_label_file "test.sighan${year}.lbl.tsv" \
--order_metric sent-correct-f1 \
--max_seq_length 512 \
--metric_reverse \
--num_save_ckpts 3 \
--remove_unused_ckpts \
--per_gpu_train_batch_size 16 \
--gradient_accumulation_steps $gradient_accumulation_steps \
--per_gpu_eval_batch_size 1 \
--learning_rate $learning_rate \
--num_train_epochs 3 \
--seed $random_seed \
--warmup_steps 1000 \
--overwrite_output_dir \
--add_pinyin_mask \
--add_pinyin_loss \
--pinyin_weight $pinyin_weight \
--use_kl \
--kl_weight $kl_weight \
--second_loss_weight $second_loss_weight \
--save_steps 2000 \
--comment "${year}-dorm-copy-test-"
done