-
Notifications
You must be signed in to change notification settings - Fork 1
/
finetune_jp.sh
55 lines (49 loc) · 1.48 KB
/
finetune_jp.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
#!/bin/sh
DATE=$(date '+%Y-%m-%d')
PROJECT_DIR=wspalign
EXPERIMENT_DIR=/data/local/qiyuw/WSPAlign/experiments-finetuning-$DATE
OUTPUT_DIR=$EXPERIMENT_DIR/finetuning
DATA_DIR=/data/10/WSPAlign # path to your test files
TRAIN_FILE=$DATA_DIR/ft_data
TEST_FILE=$DATA_DIR/test_data
MODEL_TYPE=mbert
MODEL_NAME=qiyuw/WSPAlign-mbert-base # path to your model
date
hostname
echo $EXPERIMENT_DIR
rm -rf $EXPERIMENT_DIR/*
echo ""
echo "### finetuning ###"
mkdir -p $OUTPUT_DIR
simple_hypersearch \
"
mkdir -p $OUTPUT_DIR/{lang}-{lr}-{bz}
python $PROJECT_DIR/run_spanpred.py \
--model_type $MODEL_TYPE \
--model_name_or_path $MODEL_NAME \
--do_train \
--do_eval \
--eval_all_checkpoints \
--train_file $TRAIN_FILE/{lang}_ft.json \
--predict_file $TEST_FILE/{lang}_test.json \
--learning_rate {lr} \
--per_gpu_train_batch_size {bz} \
--num_train_epochs 5 \
--max_seq_length 384 \
--max_query_length 158 \
--max_answer_length 158 \
--doc_stride 64 \
--n_best_size 10 \
--data_dir $OUTPUT_DIR/{lang}-{lr}-{bz} \
--output_dir $OUTPUT_DIR/{lang}-{lr}-{bz} \
--overwrite_output_dir \
--save_steps 10000000 \
--thread 4 2>&1 \
--per_gpu_eval_batch_size 12 \
--logging_steps 500 \
--version_2_with_negative \
| tee $EXPERIMENT_DIR/finetuning-{lang}-{lr}-{bz}.log
rm $OUTPUT_DIR/{lang}-{lr}-{bz}/checkpoint*
rm $OUTPUT_DIR/{lang}-{lr}-{bz}/cached*
" \
-p lang kftt -p lr 1e-6 3e-6 1e-5 3e-5 -p bz 5 8 12 | simple_gpu_scheduler --gpus 0