Datasets:

Modalities:
Text
Formats:
json
Size:
< 1K
Libraries:
Datasets
pandas
License:
File size: 1,245 Bytes
c8bee36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
mport os
import json
from datasets import DatasetInfo, GeneratorBasedBuilder, SplitGenerator, Split

class AReaLBoba2RLCode(GeneratorBasedBuilder):
    VERSION = "1.0.0"

    def _info(self):
        return DatasetInfo(
            description="AReaL-boba-2-RL-Code dataset (only train split)",
            features={
                "input": {"dtype": "string", "id": None},
                "output": {"dtype": "string", "id": None},
            },
            supervised_keys=None,
        )

    def _split_generators(self, dl_manager):
        data_dir = dl_manager.download_and_extract(self.config.data_dir or ".")
        train_path = os.path.join(data_dir, "train", "train.jsonl")

        return [
            SplitGenerator(
                name=Split.TRAIN,
                gen_kwargs={"filepath": train_path},
            ),
        ]

    def _generate_examples(self, filepath):
        with open(filepath, encoding="utf-8") as f:
            for idx, line in enumerate(f):
                if not line.strip():
                    continue
                data = json.loads(line)
                yield idx, {
                    "input": data.get("input", ""),
                    "output": data.get("output", ""),
                }