File size: 1,505 Bytes
ab9dacf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env bash
# Run BEAR inference on THIS task folder's JSON file(s).
# A copy of this script lives inside every task folder; the shared runners and
# util/ live at the repository root (one level up).
#
# Usage:   bash run.sh <series> <model_name>
#   <series> = gpt | gemini | claude   -> API models   (run_api_model.py)
#   <series> = image                   -> local VLM     (run_image_model.py, needs vlmeval)
#
# Examples:
#   bash run.sh gpt    gpt-4o
#   bash run.sh gemini gemini-2.5-pro
#   bash run.sh claude claude-sonnet-4-20250514
#   bash run.sh image  llava_next
#
# Media paths inside each JSON are relative to the task folder, so we cd here first.
set -euo pipefail

HERE="$(cd "$(dirname "$0")" && pwd)"
ROOT="$(cd "$HERE/.." && pwd)"
SERIES="${1:?series: gpt|gemini|claude|image}"
MODEL="${2:?model name}"

cd "$HERE"
shopt -s nullglob
for JSON in *_official.json vqa_all_episodes.json; do
    echo "=================  $JSON  ================="
    TAG="$(basename "${JSON%.json}")"
    if [ "$SERIES" = "image" ]; then
        python "$ROOT/run_image_model.py" \
            --model_name "$MODEL" \
            --input_json_path "$JSON" \
            --evaluate_output_category "$TAG"
    else
        python "$ROOT/run_api_model.py" \
            --model_name "$MODEL" \
            --model_series "$SERIES" \
            --input_json_path "$JSON" \
            --evaluate_output_category "$TAG"
    fi
done
echo "Done. Outputs: final_${MODEL}_evaluate_*.json in this folder."