-
Notifications
You must be signed in to change notification settings - Fork 789
/
Copy pathrun_finetuning.sh
56 lines (51 loc) · 1.91 KB
/
run_finetuning.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
#!/usr/bin/env bash
# ==============================================================================
# Copyright 2017 Baidu.com, Inc. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
set -xe
export FLAGS_sync_nccl_allreduce=0
export FLAGS_eager_delete_tensor_gb=1
# set CUDA_VISIBLE_DEVICES
export CUDA_VISIBLE_DEVICES=0
# path of pre_train model
ERNIE_BASE_PATH=ernie_model
# path to save checkpoint
CHECKPOINT_PATH=output/
mkdir -p $CHECKPOINT_PATH
# path of train and dev data
DATA_PATH_train=data/train
DATA_PATH_dev=data/dev
# fine-tune params
python -u src/run_mrqa.py --use_cuda true\
--batch_size 4 \
--in_tokens false \
--init_pretraining_params ${ERNIE_BASE_PATH}/params \
--checkpoints ${CHECKPOINT_PATH} \
--vocab_path ${ERNIE_BASE_PATH}/vocab.txt \
--do_train true \
--do_predict true \
--save_steps 10000 \
--warmup_proportion 0.1 \
--weight_decay 0.01 \
--epoch 2 \
--max_seq_len 512 \
--bert_config_path ${ERNIE_BASE_PATH}/ernie_config.json \
--predict_file ${DATA_PATH_dev}/mrqa-combined.raw.json \
--do_lower_case true \
--doc_stride 128 \
--train_file ${DATA_PATH_train}/mrqa-combined.raw.json \
--learning_rate 3e-5 \
--lr_scheduler linear_warmup_decay \
--skip_steps 200