Replace with Croissant-friendly questions table
Browse filesFiles changed (3)
261 unmodified lines262263264265266267261 unmodified linesjson_root = args.json_rootquestion_files = sorted(p for p in json_root.rglob("*.json") if p.parent != json_root)id_width = max(4, len(str(len(question_files))))records = [record_for_file(path, json_root, f"{index:0{id_width}d}")261 unmodified lines262263264265266267268269270261 unmodified linesjson_root = args.json_rootquestion_files = sorted(p for p in json_root.rglob("*.json") if p.parent != json_root)if not question_files:raise SystemExit(f"No question JSON files found under {json_root}")id_width = max(4, len(str(len(question_files))))records = [record_for_file(path, json_root, f"{index:0{id_width}d}")
1 unmodified line2345678910111213141516171819201 unmodified line222324252627282930313233341 unmodified linefrom __future__ import annotationsimport argparseimport subprocessimport sysfrom pathlib import Pathfrom huggingface_hub import HfApidef run_export(repo_root: Path) -> None:subprocess.run([sys.executable, "scripts/export_hf_questions.py"],cwd=repo_root,check=True,)def main() -> int:1 unmodified lineparser.add_argument("--repo-id", default="ESI-Bench/esi-bench")parser.add_argument("--repo-root", type=Path, default=Path(__file__).resolve().parents[1])parser.add_argument("--private", action="store_true", help="Create the dataset repo as private if it does not exist.")parser.add_argument("--skip-export", action="store_true", help="Upload existing data/questions.jsonl without regenerating it.")parser.add_argument("--commit-message", default="Replace with Croissant-friendly questions table")args = parser.parse_args()repo_root = args.repo_root.resolve()if not args.skip_export:run_export(repo_root)api = HfApi()api.create_repo(repo_id=args.repo_id, repo_type="dataset", private=args.private, exist_ok=True)1 unmodified line234567891011121314151617181 unmodified line20212223242526272829301 unmodified linefrom __future__ import annotationsimport argparsefrom pathlib import Pathfrom huggingface_hub import HfApidef validate_dataset_file(repo_root: Path) -> None:dataset_file = repo_root / "data/questions.jsonl"if not dataset_file.exists():raise SystemExit(f"Missing {dataset_file}")if dataset_file.stat().st_size == 0:raise SystemExit(f"{dataset_file} is empty. Regenerate it before uploading.")def main() -> int:1 unmodified lineparser.add_argument("--repo-id", default="ESI-Bench/esi-bench")parser.add_argument("--repo-root", type=Path, default=Path(__file__).resolve().parents[1])parser.add_argument("--private", action="store_true", help="Create the dataset repo as private if it does not exist.")parser.add_argument("--commit-message", default="Replace with Croissant-friendly questions table")args = parser.parse_args()repo_root = args.repo_root.resolve()validate_dataset_file(repo_root)api = HfApi()api.create_repo(repo_id=args.repo_id, repo_type="dataset", private=args.private, exist_ok=True)
data/questions.jsonl
scripts/export_hf_questions.py+3
scripts/upload_hf_dataset.py+7-11