Load the GSM-hard math dataset from the local JSONL file. Args: limit: Optional maximum number of problems to load. If None, loads all problems. Returns: A list of GsmProblem instances.
(limit: Optional[int] = None)
| 67 | |
| 68 | |
| 69 | def load_math_dataset(limit: Optional[int] = None) -> Dataset[GsmProblem]: |
| 70 | """Load the GSM-hard math dataset from the local JSONL file. |
| 71 | |
| 72 | Args: |
| 73 | limit: Optional maximum number of problems to load. If None, loads all problems. |
| 74 | |
| 75 | Returns: |
| 76 | A list of GsmProblem instances. |
| 77 | """ |
| 78 | with open("data_gsmhard.jsonl", "r") as f: |
| 79 | problems = [GsmProblem(**json.loads(line)) for line in f] |
| 80 | if limit is not None: |
| 81 | problems = problems[:limit] |
| 82 | return problems |
| 83 | |
| 84 | |
| 85 | @rollout |
no test coverage detected