#!/usr/bin/env python3 """ DM-GRPO Final Evaluation Script ================================ Unified evaluation with LOCKED system prompt (matches grpo.py training prompt). DO NOT modify SYSTEM_MESSAGE without updating the training prompt in grpo.py. Usage: python eval.py --model_path /path/to/model --file_name exp1 --benchmarks tempcompass python eval.py --model_path /path/to/model --file_name exp1 --benchmarks all --nframes 32 """ import os import json import re import math import argparse from tqdm import tqdm import torch from transformers import AutoProcessor, AutoTokenizer from vllm import LLM, SamplingParams from qwen_vl_utils import process_vision_info # ========================== LOCKED System Prompt ========================== # This MUST match grpo.py SYSTEM_PROMPT exactly. Do NOT modify independently. # Source: grpo.py L489-L508 (SFT-v9 aligned, 0.1s precision) # Last verified: 2026-04-22 SYSTEM_MESSAGE = ( "A conversation between User and Assistant. The user asks a question about " "a video, and the Assistant solves it. The assistant first analyzes the video " "by establishing reference frames with