yqi19's picture
Add runnable eval code: API/local runners, GPT-judge scorer, per-task run.sh, util, README
ab9dacf verified
Raw
History Blame Contribute Delete
1.51 kB
#!/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."