Initialize AIME 2025 Dataset. Args: path: Base path to the dataset directory name: Dataset name (Not used for filtering, kept for compatibility) split: Dataset split ("test", "validation", etc.)
(self, path, name, split, **kwargs)
| 9 | @DATASET.register_module(force=True) |
| 10 | class AIME25Dataset: |
| 11 | def __init__(self, path, name, split, **kwargs): |
| 12 | """ |
| 13 | Initialize AIME 2025 Dataset. |
| 14 | |
| 15 | Args: |
| 16 | path: Base path to the dataset directory |
| 17 | name: Dataset name (Not used for filtering, kept for compatibility) |
| 18 | split: Dataset split ("test", "validation", etc.) |
| 19 | """ |
| 20 | self.path = path |
| 21 | self.name = name |
| 22 | self.split = split |
| 23 | |
| 24 | # 1. Path processing |
| 25 | base_path = assemble_project_path(path) |
| 26 | split_path = os.path.join(base_path, split) |
| 27 | |
| 28 | if not os.path.exists(split_path): |
| 29 | raise FileNotFoundError(f"Split directory not found: {split_path}") |
| 30 | |
| 31 | # 2. Find all metadata.jsonl files in subdirectories |
| 32 | # Structure: datasets/AIME25/test/AIME2025-I/metadata.jsonl, AIME2025-II/metadata.jsonl, etc. |
| 33 | data_rows = [] |
| 34 | |
| 35 | # Traverse all subdirectories in the split directory |
| 36 | for item in os.listdir(split_path): |
| 37 | item_path = os.path.join(split_path, item) |
| 38 | if os.path.isdir(item_path): |
| 39 | metadata_file = os.path.join(item_path, "metadata.jsonl") |
| 40 | if os.path.exists(metadata_file): |
| 41 | # Read data from this metadata.jsonl |
| 42 | with open(metadata_file, "r", encoding="utf-8") as f: |
| 43 | for line in f: |
| 44 | line = line.strip() |
| 45 | if not line: |
| 46 | continue |
| 47 | try: |
| 48 | row = json.loads(line) |
| 49 | except json.JSONDecodeError: |
| 50 | continue |
| 51 | |
| 52 | q_text = row.get("problem") or row.get("question") |
| 53 | a_text = row.get("answer") |
| 54 | |
| 55 | if q_text: |
| 56 | unique_id = str(row.get("task_id", f"aime25_{len(data_rows)}")) |
| 57 | |
| 58 | data_row = { |
| 59 | "task_id": unique_id, |
| 60 | "question": q_text, |
| 61 | "true_answer": str(a_text) if a_text is not None else "", |
| 62 | "task": "AIME 2025" |
| 63 | } |
| 64 | |
| 65 | # Defensive answer handling: handle numeric answer in json |
| 66 | if isinstance(data_row["true_answer"], (int, float)): |
| 67 | data_row["true_answer"] = str(int(data_row["true_answer"])) |
| 68 |