#!/bin/bash
#SBATCH -p gpu
#SBATCH -x sls-titan-[0-2]
##SBATCH -p sm
#SBATCH --gres=gpu:4
#SBATCH -c 4
#SBATCH -n 1
#SBATCH --mem=48000
#SBATCH --job-name="ast-sc"
#SBATCH --output=./log_%j.txt

set -x

export TORCH_HOME=../../pretrained_models

model=ast
dataset=speechcommands
imagenetpretrain=True
audiosetpretrain=False
bal=none
lr=2.5e-4
epoch=20
freqm=48
timem=48
mixup=0.6
batch_size=8
fstride=10
tstride=10

dataset_mean=-6.845978
dataset_std=5.5654526
audio_length=1024
noise=True

metrics=acc
loss=BCE
warmup=False
lrscheduler_start=5
lrscheduler_step=1
lrscheduler_decay=0.85

tr_data=./data/AUDIO/CABRH8_train1_data.json
val_data=./data/AUDIO/CABRH8_val1_data.json
eval_data=./data/AUDIO/CABRH8_val1_data.json
exp_dir=./exp/test-${dataset}-f$fstride-t$tstride-p$imagenetpretrain-b$batch_size-lr${lr}-decoupe

if [ -d $exp_dir ]; then
  echo 'exp exist'
  exit
fi
mkdir -p $exp_dir

python ./prep_sc.py

CUDA_CACHE_DISABLE=1 python -W ignore ../../src/run.py --model ${model} --dataset ${dataset} \
--data-train ${tr_data} --data-val ${val_data} --data-eval ${eval_data} --exp-dir $exp_dir \
--label-csv ./data/cabrh8_class_labels_indices.csv --n_class 8 \
--lr $lr --n-epochs ${epoch} --batch-size $batch_size --save_model True \
--freqm $freqm --timem $timem --mixup ${mixup} --bal ${bal} \
--dataset_mean ${dataset_mean} --dataset_std ${dataset_std} --audio_length ${audio_length} --noise ${noise} \
--metrics ${metrics} --loss ${loss} --warmup ${warmup} --lrscheduler_start ${lrscheduler_start} --lrscheduler_step ${lrscheduler_step} --lrscheduler_decay ${lrscheduler_decay} \
--tstride $tstride --fstride $fstride --imagenet_pretrain $imagenetpretrain --audioset_pretrain $audiosetpretrain > $exp_dir/log.txt
