finetune_bart_tiny.sh 848 Bytes
Newer Older
1
2
3
# Script for verifying that run_bart_sum can be invoked from its directory

# Get tiny dataset with cnn_dm format (4 examples for train, val, test)
4
wget https://cdn-datasets.huggingface.co/summarization/cnn_tiny.tgz
5
6
7
8
9
10
11
12
13
14
tar -xzvf cnn_tiny.tgz
rm cnn_tiny.tgz

export OUTPUT_DIR_NAME=bart_utest_output
export CURRENT_DIR=${PWD}
export OUTPUT_DIR=${CURRENT_DIR}/${OUTPUT_DIR_NAME}

# Make output directory if it doesn't exist
mkdir -p $OUTPUT_DIR

15
# Add parent directory to python path to access lightning_base.py and testing_utils.py
16
export PYTHONPATH="../":"${PYTHONPATH}"
17
python finetune.py \
18
19
20
21
22
23
24
--data_dir=cnn_tiny/ \
--model_name_or_path=sshleifer/bart-tiny-random \
--learning_rate=3e-5 \
--train_batch_size=2 \
--eval_batch_size=2 \
--output_dir=$OUTPUT_DIR \
--num_train_epochs=1  \
25
--gpus=0 \
26
--do_train "$@"
27
28
29
30
31
32

rm -rf cnn_tiny
rm -rf $OUTPUT_DIR