-
Notifications
You must be signed in to change notification settings - Fork 124
/
Copy pathrun_all_benchmarks.sh
executable file
·69 lines (58 loc) · 1.68 KB
/
run_all_benchmarks.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
#!/bin/bash
set -e
echo "> run_all_benchmarks.sh $@"
ckpt="$1"
conv_mode="$2"
benchmarks=(
gqa
vizwiz
scienceqa
textvqa
pope
mme
mmbench_en
mmbench_cn
seed
mmvet
mmmu
mathvista
ai2d
chartqa
docvqa
infovqa
stvqa
ocrbench
mmstar
realworldqa
synthdog
)
# Create a directory for checkpoint files if it doesn't exist
checkpoint_dir="checkpoints"
mkdir -p "$checkpoint_dir"
# Generate a unique checkpoint file name based on the script arguments
checkpoint_file="$checkpoint_dir/checkpoint_$(basename $ckpt)_$conv_mode.txt"
script_dir=$(dirname $(realpath $0))
# Check if the checkpoint file exists and load the completed benchmarks
if [[ -f "$checkpoint_file" ]]; then
completed_benchmarks=($(cat "$checkpoint_file"))
echo "Resuming from checkpoint. Completed benchmarks: ${completed_benchmarks[@]}"
else
completed_benchmarks=()
fi
timestamp=$(date +%Y%m%d-%H%M%S)
for benchmark in "${benchmarks[@]}"; do
if [[ " ${completed_benchmarks[@]} " =~ " $benchmark " ]]; then
echo "Skipping completed benchmark: $benchmark"
continue
fi
echo "Running benchmark: $benchmark"
bash $script_dir/run_benchmark.sh --benchmark $benchmark --ckpt $ckpt --conv_mode $conv_mode
echo "Finished benchmark: $benchmark"
# Append the completed benchmark to the checkpoint file
echo "$benchmark" >> "$checkpoint_file"
cur_timestamp=$(date +%Y%m%d-%H%M%S)
echo "Elapsed minutes: $(( ($(date -d $cur_timestamp +%s) - $(date -d $timestamp +%s)) / 60 ))"
echo ""
done
echo "Finished all benchmarks"
echo "Elapsed minutes: $(( ($(date -d $cur_timestamp +%s) - $(date -d $timestamp +%s)) / 60 ))"