-
Notifications
You must be signed in to change notification settings - Fork 4
/
sweep_glue.sh
executable file
·40 lines (35 loc) · 1.1 KB
/
sweep_glue.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
#!/bin/bash
set -e
function die
{
local message=$1
[ -z "$message" ] && message="Died"
echo "$message at ${BASH_SOURCE[1]}:${FUNCNAME[1]} line ${BASH_LINENO[0]}." >&2
exit 1
}
[ -z "$1" ] && die "Usage: run_glue.sh INIT_CHECKPOINT OUTPUT_DIR LR [LR ...]"
INIT_CHECKPOINT=$1
shift
[ -z "$1" ] && die "Usage: run_glue.sh INIT_CHECKPOINT OUTPUT_DIR LR [LR ...]"
OUTPUT_DIR=$1
shift
[ -z "$1" ] && die "Usage: run_glue.sh INIT_CHECKPOINT OUTPUT_DIR LR [LR ...]"
LEARNING_RATES="$@"
echo "INIT_CHECKPOINT=${INIT_CHECKPOINT?}"
echo "OUTPUT_DIR=${OUTPUT_DIR?}"
echo "LEARNING_RATES=${LEARNING_RATES?}"
[ ! -d "${INIT_CHECKPOINT?}" ] && die "Not a checkpoint directory: '${INIT_CHECKPOINT?}'"
set -x
for LR in $LEARNING_RATES
do
for TASK in cola mrpc qqp sst2 stsb mnli qnli rte
do
mkdir -p "${OUTPUT_DIR?}/lr${LR?}/${TASK?}"
python3 run_classifier.py \
--config=configs/classifier.py \
--config.init_checkpoint="${INIT_CHECKPOINT}" \
--config.dataset_name="${TASK?}" \
--config.learning_rate="${LR}" \
--output_dir="${OUTPUT_DIR?}/lr${LR?}/${TASK?}"
done
done