run_finetuning.sh 1.9 KB
Newer Older
H
Hongyu Li 已提交
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
#!/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
H
Hongyu Li 已提交
27
ERNIE_BASE_PATH=ernie_model
H
Hongyu Li 已提交
28 29 30 31 32 33 34 35 36 37 38
# 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 \
H
Hongyu Li 已提交
39
        --init_pretraining_params ${ERNIE_BASE_PATH}/params \
H
Hongyu Li 已提交
40
        --checkpoints ${CHECKPOINT_PATH} \
H
Hongyu Li 已提交
41
        --vocab_path ${ERNIE_BASE_PATH}/vocab.txt \
H
Hongyu Li 已提交
42 43 44 45 46 47 48
        --do_train true \
        --do_predict true \
        --save_steps 10000 \
        --warmup_proportion 0.1 \
        --weight_decay  0.01 \
        --epoch 2 \
        --max_seq_len 512 \
H
Hongyu Li 已提交
49
        --bert_config_path ${ERNIE_BASE_PATH}/ernie_config.json \
H
Hongyu Li 已提交
50
        --predict_file ${DATA_PATH_dev}/mrqa-combined.raw.json \
H
Hongyu Li 已提交
51
        --do_lower_case true \
H
Hongyu Li 已提交
52 53 54 55 56
        --doc_stride 128 \
        --train_file ${DATA_PATH_train}/mrqa-combined.raw.json \
        --learning_rate 3e-5 \
        --lr_scheduler linear_warmup_decay \
        --skip_steps 200