|
#!/bin/bash |
|
PROJECT_DIR=${HOME}"/models/t5-political-evaluator" |
|
export PYTHONPATH=${PROJECT_DIR} |
|
|
|
|
|
|
|
|
|
FINETUNE_STEPS=5000 |
|
MODEL_BUCKET_DIR="gs://nb-t5x-us-central2/finetuned/" |
|
EVAL_PREFIX="ul2test/eval_political_" |
|
CHECKPOINT_BUCKET_DIR="gs://nb-t5x-us-central2/" |
|
CHECKPOINT_LIST=("exp1-t5-base-ul2-engvoc" "exp2-t5-base-ul2-scandvoc" "exp3-t5-base-span-engvoc" "exp4-t5-base-span-scandvoc" "exp5-t5-base-ul2-scandvoc-full" "exp6-t5-base-span-scandvoc-full" "exp7-t5-base-ul2-511-scandvoc" "exp8-t5-base-span-511-scandvoc" "exp9-t5-base-ul2-mt5voc" "exp10-t5-base-span-mt5voc" "exp11-t5-base-ul2-511-scandvoc-full" "exp12-t5-base-span-511-scandvoc-full" "exp13-t5-base-ul2-mt5voc-full" "exp14-t5-base-span-mt5voc-full" "exp15-t5-base-ul2-511-scandvoc-full-scratch" "exp16-t5-base-span-511-scandvoc-full-scratch" "exp17-t5-small-ul2-mt5voc-scratch" "exp18-t5-small-span-mt5voc-scratch" "exp19-t5-small-ul2-mt5voc" "exp20-t5-small-span-mt5voc" "exp21-t5-small-ul2-mt5voc-full" "exp22-t5-small-span-mt5voc-full") |
|
|
|
|
|
PRETUNE_START_LIST=(100000 200000 300000 400000 500000 1000000 1100000 1184000 1200000 1204000 1284000 1300000 1384000 1400000 1484000 1500000) |
|
VERSION_LIST=("1" "2" "3" "4" "5") |
|
|
|
index=$(($1 + 0)) |
|
|
|
if [ $index -lt 1 ] || [ $index -gt ${#CHECKPOINT_LIST[@]} ] || [ $# -ne 1 ]; then |
|
echo "Error: You need to provide the number of the checkpoints below as a parameter." |
|
for i in "${!CHECKPOINT_LIST[@]}"; do |
|
echo "$((i+1)). ${CHECKPOINT_LIST[i]}" |
|
done |
|
|
|
exit 1 |
|
fi |
|
|
|
|
|
|
|
for v in "${VERSION_LIST[@]}"; do |
|
for s in "${PRETUNE_START_LIST[@]}"; do |
|
INITIAL_CHECKPOINT_PATH="${CHECKPOINT_BUCKET_DIR}${CHECKPOINT_LIST[$((index-1))]}/checkpoint_${s}" |
|
TRAIN_STEPS=$((s+FINETUNE_STEPS)) |
|
if [[ "$INITIAL_CHECKPOINT_PATH" == *"engvoc"* ]]; then |
|
GIN_FILE="finetune_classification_base.gin" |
|
MIXTURE_OR_TASK_NAME="parliament_max300" |
|
elif [[ "$INITIAL_CHECKPOINT_PATH" == *"scandvoc"* ]]; then |
|
GIN_FILE="finetune_classification_base_scand.gin" |
|
MIXTURE_OR_TASK_NAME="parliament_max300_scand" |
|
else |
|
if [[ "$INITIAL_CHECKPOINT_PATH" == *"small"* ]]; then |
|
GIN_FILE="finetune_classification_small_mt5.gin" |
|
else |
|
GIN_FILE="finetune_classification_base_mt5.gin" |
|
fi |
|
MIXTURE_OR_TASK_NAME="parliament_max300_mt5" |
|
fi |
|
|
|
MODEL_DIR="${MODEL_BUCKET_DIR}${EVAL_PREFIX}v${v}_${CHECKPOINT_LIST[$((index-1))]}_${s}" |
|
command="python3 ../../t5x/t5x/train.py --gin_search_paths=\"./\" --gin.TRAIN_STEPS=${TRAIN_STEPS} --gin_file=${GIN_FILE} --gin.INITIAL_CHECKPOINT_PATH=\\\"${INITIAL_CHECKPOINT_PATH}\\\" --gin.MIXTURE_OR_TASK_NAME=\\\"${MIXTURE_OR_TASK_NAME}\\\" --gin.MODEL_DIR=\\\"${MODEL_DIR}\\\"" |
|
echo "${command}" |
|
|
|
eval "${command}" |
|
done |
|
done |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|