Load completed results from a previous run.
(output_dir: Path)
| 13 | |
| 14 | |
| 15 | def _load_existing_results(output_dir: Path) -> Dict[str, AIMEResult]: |
| 16 | """Load completed results from a previous run.""" |
| 17 | existing = {} |
| 18 | for json_path in output_dir.glob("*.json"): |
| 19 | try: |
| 20 | with json_path.open("r") as f: |
| 21 | data = json.load(f) |
| 22 | if data.get("status") == "completed": |
| 23 | existing[data["problem_id"]] = AIMEResult( |
| 24 | problem_id=data["problem_id"], |
| 25 | problem=data.get("problem", ""), |
| 26 | correct_answer=data.get("correct_answer", ""), |
| 27 | dataset=data.get("dataset", ""), |
| 28 | status="completed", |
| 29 | response=data.get("response", ""), |
| 30 | parsed_answer=data.get("parsed_answer"), |
| 31 | is_correct=data.get("is_correct", False), |
| 32 | ) |
| 33 | except (json.JSONDecodeError, KeyError): |
| 34 | continue |
| 35 | return existing |
| 36 | |
| 37 | |
| 38 | def _load_problems(dataset="all", problem_ids=None, limit=None) -> List[dict]: |
no test coverage detected