FORGE-Bench / data_types.py
thomeboi's picture
Upload 8 files
561dd23 verified
Raw History Blame Contribute Delete
800 Bytes
"""Data types for the public FORGE-Bench v15 JSONL release.
The package intentionally uses JSONL and does not require Parquet.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Iterator
import json
from pathlib import Path
@dataclass(frozen=True)
class TrainExample:
id: str
assembly_id: str
split: str
public_task: dict[str, Any]
reference_output: dict[str, Any]
@dataclass(frozen=True)
class TestExample:
id: str
assembly_id: str
split: str
public_task: dict[str, Any]
def read_jsonl(path: str | Path) -> Iterator[dict[str, Any]]:
with Path(path).open(encoding="utf-8") as handle:
for line in handle:
if line.strip():
yield json.loads(line)