File size: 800 Bytes
561dd23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""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)