-
Notifications
You must be signed in to change notification settings - Fork 2
/
grading.slurm
73 lines (55 loc) · 1.85 KB
/
grading.slurm
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
#!/bin/bash
#SBATCH -N 1 ## Node count
#SBATCH --gres=gpu:0
#SBATCH --ntasks-per-node=1
#SBATCH -t 0-02:00:00 ## Walltime
#SBATCH --mem=10G
#SBATCH -c 2
#SBATCH --account=
#SBATCH --array=1-56
#SBATCH --output=logs/%x-%j-%a.out
#SBATCH --job-name=grading
# i * 7 + (k-1) = $SLURM_ARRAY_TASK_ID - 1
i=$((($SLURM_ARRAY_TASK_ID - 1) / 7))
k=$((($SLURM_ARRAY_TASK_ID - 1) % 7 + 1))
#!/bin/sh
source ~/.bashrc
conda activate t2v
scores_base_dir="./all_ind_scores"
scores_dir="${scores_base_dir}/k_results_300"
models=(
"gpt"
"llava_score_13b"
"instructblip_score"
"clip_score"
"blip_itm_score"
"pick_score"
"hpsv2_score"
"image_reward_score"
)
run_demo() {
image_question_path=$1
model_name=$2
if [ ! -d "$scores_dir" ]; then
echo "$(date): Creating directory $scores_dir" | tee /dev/stderr
mkdir -p "$scores_dir"
fi
model_name_short=$(basename "$(dirname "$(dirname "$image_question_path")")")
k_value=$(basename "$(dirname "$image_question_path")")
score_path="${scores_dir}/${model_name_short}_k=${k_value}_score.json"
echo "$(date): Running $model_name on $image_question_path" | tee /dev/stderr
echo "$(date): Score path should be: $score_path" | tee /dev/stderr
score=$(python ./dynamix/grading/multi_grading.py --image_question_path "$image_question_path" --model_name "$model_name" --score_path $score_path)
echo "{\"image_question_path\": \"$image_question_path\", \"score\": $score},"
}
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <directory>"
exit 1
fi
input_dir=$1
echo "$(date): Script started" | tee /dev/stderr
model_name=${models[$i]}
image_question_path="${input_dir}/${model_name}/${k}/result.json"
echo "$(date): Calling run_demo with $image_question_path $model_name" | tee /dev/stderr
run_demo "$image_question_path" "$model_name"
echo "$(date): Script finished" | tee /dev/stderr