-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrun_en_bert.sh
executable file
·64 lines (52 loc) · 1.65 KB
/
run_en_bert.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
58
59
60
61
62
63
64
#! /bin/bash
source your_path/bin/activate your_path/envs/transformers
HOME_DIR="/your_path/exp_covid19_disinfo"
train=$HOME_DIR/"data/english/covid19_disinfo_english_multiclass_train.tsv"
dev=$HOME_DIR/"data/english/covid19_disinfo_english_multiclass_dev.tsv"
tst=$HOME_DIR/"data/english/covid19_disinfo_english_multiclass_test.tsv"
task="multiclass"
export GLUE_DIR=data
export TASK_NAME=multiclass
fname=`basename $train .tsv`
tst_fname=`basename $tst .tsv`
declare -a questions=("q1" "q2" "q3" "q4" "q5" "q6" "q7" )
label_index=1
for q_dir in ${questions[@]};
do
label_index=$((label_index+1))
echo $label_index
if [ $task == "multiclass" ] && [ $q_dir == "q1" ]
then
echo $task
continue
fi
seed=42
run="run_"$seed
output_file=$HOME_DIR/results/bert/en/$q_dir/$fname/$tst_fname"_"$run".json"
mkdir -p $HOME_DIR/results/bert/en/$q_dir/$fname/
export GLUE_DIR=cache/
export TASK_NAME=multiclass
outputdir=$HOME_DIR/experiments/bert/en/$q_dir/$fname/$run/
data_dir=$GLUE_DIR/$TASK_NAME/bert/en/$q_dir/$fname/$run/
mkdir -p $outputdir
mkdir -p $data_dir
python bin/transformers/run_glue.py \
--model_name_or_path bert-base-uncased \
--label_index $label_index \
--task_name $TASK_NAME \
--train_file $train \
--dev_file $dev \
--test_file $tst \
--out_file $output_file \
--do_train \
--do_eval \
--data_dir $data_dir \
--max_seq_length 128 \
--per_device_eval_batch_size=32 \
--per_device_train_batch_size=32 \
--learning_rate 2e-5 \
--num_train_epochs 10.0 \
--output_dir $outputdir \
--seed $seed \
--overwrite_output_dir
done