Spaces:
Running

ruhzi's picture
ForesightBench RL environment + rollout browser
effcad2 verified
Raw History Blame Contribute Delete
690 Bytes
"""Paper-disjoint train/eval split of ForesightBench, bundled as jsonl."""
from __future__ import annotations
import json
from pathlib import Path
from typing import Literal
_PKG = Path(__file__).resolve().parent
def load_split(name: Literal["train", "eval"], root: Path | None = None) -> list[dict]:
"""Rows of one split, bundled inside the package. `root` overrides with <root>/data/."""
if name not in ("train", "eval"):
raise ValueError(f"unknown split {name!r}")
path = ((root / "data") if root else (_PKG / "data")) / f"{name}.jsonl"
with path.open(encoding="utf-8") as fh:
return [json.loads(line) for line in fh if line.strip()]