#!/bin/bash

#SBATCH --partition=gpu_titanrtx_shared
#SBATCH --gres=gpu:1
#SBATCH --job-name=input_div_array
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=3
#SBATCH --time=00:15:00
#SBATCH --mem=32000M
#SBATCH --output=slurm/input_div_output_%A_%a.out
#SBATCH --array=1-20%20

module purge
module load 2021
module load Anaconda3/2021.05

cd $HOME/active_learning

# copy all data from home folder to SCRATCH
cp -r $HOME/active_learning/resources/. "$TMPDIR"
# also copy acquisition ID data from previous run to SCRATCH
cp -r $HOME/active_learning/results/. "$TMPDIR"

# create folder on scratch disk to store output
mkdir "$TMPDIR"/ard_output_dir_checkpoints

# Your job starts in the directory where you call sbatch
cd $HOME/active_learning
# Activate your environment
source activate active

HPARAMS_FILE=$HOME/active_learning/new_jobs/hparams/input_div_hyperparameters.txt

# Run your code
srun python main.py \
            --input_dir "$TMPDIR/ard_data" \
            --output_dir "$TMPDIR/ard_output_dir_results" \
            --checkpoint_dir "$TMPDIR/ard_output_dir_checkpoints" \
            --project_dir="array" \
            --array_uid="main experiment METRICS WANLI 25-07" \
            --metrics_uid="WANLI baseline" \
            --model_id="roberta-large" \
            --train_sets="WANLI_1.0" \
            --dev_sets="WANLI" \
            --ood_sets="WANLI" \
            --test_sets="WANLI" \
            --max_dev_size=2200 \
            --seed_size=500 \
            --downsample_rate=0.2 \
            --labelling_batch_size=500 \
            --al_iterations=7 \
            --dropout=0.3 \
            --mc_iterations=4 \
            --lr=2e-5 \
            --batch_size=8 \
            --accumulate_grad_batches=4 \
            --patience=10 \
            --monitor="val_acc" \
            --val_check_interval=0.25 \
            --num_workers=0 \
            --progress_bar \
            --precision=16 \
            --log_every=1 \
            --refresh_rate=25 \
            --wanli_id_key="pairID" \
            $(head -$SLURM_ARRAY_TASK_ID $HPARAMS_FILE | tail -1)

cp -r "$TMPDIR"/ard_output_dir_results $HOME/active_learning/results