Test the benchmark manager specifically for Math/AIME using a REAL model. Uses response_format for structured output.
(benchmark_name: str = "aime25")
| 40 | return re.sub(r'[\\/*?:"<>|]', '', name).strip() |
| 41 | |
| 42 | async def test_math_benchmark(benchmark_name: str = "aime25"): |
| 43 | """ |
| 44 | Test the benchmark manager specifically for Math/AIME using a REAL model. |
| 45 | Uses response_format for structured output. |
| 46 | """ |
| 47 | print(f"🧪 Testing benchmark manager with benchmark: {benchmark_name}") |
| 48 | print(f"🤖 Using Model: {TARGET_MODEL}") |
| 49 | |
| 50 | # Define save directory |
| 51 | save_dir = os.path.join(config.workdir, "benchmark", benchmark_name) |
| 52 | if not os.path.exists(save_dir): |
| 53 | os.makedirs(save_dir, exist_ok=True) |
| 54 | print(f"📁 Created output directory: {save_dir}") |
| 55 | |
| 56 | # 1. Reset and get first task |
| 57 | print(f"🔄 Resetting progress for {benchmark_name}...") |
| 58 | task = await benchmark_manager.reset(benchmark_name) |
| 59 | |
| 60 | if not task: |
| 61 | logger.warning("⚠️ No tasks available to run (Dataset empty or all finished).") |
| 62 | return |
| 63 | |
| 64 | # ========================================== |
| 65 | # Loop Logic |
| 66 | # ========================================== |
| 67 | while task is not None: |
| 68 | task_id = task.task_id |
| 69 | start_time = time.time() |
| 70 | |
| 71 | try: |
| 72 | print(f"\n" + "="*50) |
| 73 | print(f"🚀 Processing Task ID: {task_id}") |
| 74 | print("="*50) |
| 75 | |
| 76 | # --- 1. Prepare Prompt --- |
| 77 | question_text = task.input |
| 78 | |
| 79 | # Get system_prompt directly from task |
| 80 | system_prompt_text = task.system_prompt |
| 81 | |
| 82 | logger.info(f"| 📋 [Task {task_id}] Input length: {len(question_text)}") |
| 83 | |
| 84 | messages = [ |
| 85 | SystemMessage(content=system_prompt_text), |
| 86 | HumanMessage(content=question_text) |
| 87 | ] |
| 88 | |
| 89 | # --- 2. Model Inference (Structured Output) --- |
| 90 | print(f"⏳ [Task {task_id}] Model inferencing (Structured)...") |
| 91 | |
| 92 | try: |
| 93 | # Call model_manager and pass response_format |
| 94 | response = await model_manager( |
| 95 | model=TARGET_MODEL, |
| 96 | messages=messages, |
| 97 | response_format=Response, |
| 98 | ) |
| 99 |
no test coverage detected