-
Notifications
You must be signed in to change notification settings - Fork 0
/
hparamsearch_run.sh
81 lines (71 loc) · 2.82 KB
/
hparamsearch_run.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
#SBATCH -J f17k_hparam # Name that will show up in squeue
#SBATCH --gres=gpu:1 # Request 1 GPUs
#SBATCH --time=7-00:00 # Max job time is 7 days
#SBATCH --cpus-per-task=16 # Number of CPU cores per task
#SBATCH --mem=32G # Max memory (CPU)
#SBATCH --output=%N-%j.out # Terminal output to file named (hostname)-(jobid).out
#SBATCH --error=%N-%j.err # Terminal output to file named (hostname)-(jobid).err
#SBATCH --partition=long # long partition (allows up to 7 days runtime)
#SBATCH [email protected]
#SBATCH --mail-type=all
#SBATCH --nodelist=cs-venus-09
#SBATCH --qos=overcap
#SBATCH --propagate=STACK
ulimit -Su unlimited
ulimit -Sv unlimited
source /home/kabhishe/.bashrc
conda activate <CONDA ENV NAME>
set -euf -o pipefail # https://sipb.mit.edu/doc/safe-shell/
cd <PATH TO CODE DIRECTORY>
# The original file directory is /localhome/kabhishe/WorkingDir/F17k_original/.
# To speed up data loading, we create a RAM disk and copy the original files there.
# mkdir -p /dev/shm/myramdisk
# cp -r /localhome/kabhishe/WorkingDir/F17k_original/ /dev/shm/myramdisk/
# Declare an array of all holdout sets.
# https://stackoverflow.com/a/8880633
declare -a holdoutsets=(
"expert_select"
"random_holdout"
"a12"
"a34"
"a56"
"dermaamin"
"br"
)
LOGS_DIR=<INSERT LOG DIRECTORY HERE>
OUTPUT_DIR=<INSERT OUTPUT DIRECTORY HERE>
# Iterate over all the epoch values.
for EPOCHS in {20,50,100,200}
do
# Iterate over both the optimizers.
for OPTIMIZER in {"SGD","Adam"}
do
# Iterate over all the learning rates.
for LR in {0.01,0.001,0.0001}
do
# Iterate over all the holdout sets.
for HOLDOUT in "${holdoutsets[@]}"
do
# Iterate over multiple seeds.
for SEED in {8887..8889}
do
# Create a log file for the current experiment in a new directory.
mkdir -p "$LOGS_DIR"/"$EPOCHS"_"$OPTIMIZER"_"$LR"
echo "Experiment for holdout set $HOLDOUT and seed $SEED" > "$LOGS_DIR"/"$EPOCHS"_"$OPTIMIZER"_"$LR"/"$HOLDOUT"_"$SEED".log
# Run the training script.
python hparamsearch_train.py \
--n_epochs $EPOCHS \
--optimizer $OPTIMIZER \
--base_lr $LR \
--dev_mode full \
--data_list_file ./SimThresh_T_A2_T_0.99_0.70_FC_T_KeepOne_Out_T_OutThresh_None_0FST_F.csv \
--images_dir /dev/shm/myramdisk/F17k_original/ \
--output_dir $OUTPUT_DIR \
--seed $SEED \
--holdout_set $HOLDOUT >> "$LOGS_DIR"/"$EPOCHS"_"$OPTIMIZER"_"$LR"/"$HOLDOUT"_"$SEED".log
done
done
done
done
done