LandyGuo
commited on
Commit
·
c8bee36
1
Parent(s):
f3ce60b
fix training data
Browse files- dataset.py +38 -0
- train/train.jsonl +2 -2
dataset.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
mport os
|
| 2 |
+
import json
|
| 3 |
+
from datasets import DatasetInfo, GeneratorBasedBuilder, SplitGenerator, Split
|
| 4 |
+
|
| 5 |
+
class AReaLBoba2RLCode(GeneratorBasedBuilder):
|
| 6 |
+
VERSION = "1.0.0"
|
| 7 |
+
|
| 8 |
+
def _info(self):
|
| 9 |
+
return DatasetInfo(
|
| 10 |
+
description="AReaL-boba-2-RL-Code dataset (only train split)",
|
| 11 |
+
features={
|
| 12 |
+
"input": {"dtype": "string", "id": None},
|
| 13 |
+
"output": {"dtype": "string", "id": None},
|
| 14 |
+
},
|
| 15 |
+
supervised_keys=None,
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
def _split_generators(self, dl_manager):
|
| 19 |
+
data_dir = dl_manager.download_and_extract(self.config.data_dir or ".")
|
| 20 |
+
train_path = os.path.join(data_dir, "train", "train.jsonl")
|
| 21 |
+
|
| 22 |
+
return [
|
| 23 |
+
SplitGenerator(
|
| 24 |
+
name=Split.TRAIN,
|
| 25 |
+
gen_kwargs={"filepath": train_path},
|
| 26 |
+
),
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
def _generate_examples(self, filepath):
|
| 30 |
+
with open(filepath, encoding="utf-8") as f:
|
| 31 |
+
for idx, line in enumerate(f):
|
| 32 |
+
if not line.strip():
|
| 33 |
+
continue
|
| 34 |
+
data = json.loads(line)
|
| 35 |
+
yield idx, {
|
| 36 |
+
"input": data.get("input", ""),
|
| 37 |
+
"output": data.get("output", ""),
|
| 38 |
+
}
|
train/train.jsonl
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:07196b4fbc74e8961bc458261a5f1c361c9f7978482682218188937148342b3e
|
| 3 |
+
size 6869950785
|