yuvalkirstain
commited on
Commit
•
ae7a3e8
1
Parent(s):
0fdc204
remove original input output cols
Browse files
normalize_raw_data/normalize_scrolls.py
CHANGED
@@ -2,18 +2,16 @@ import os
|
|
2 |
import shutil
|
3 |
from fire import Fire
|
4 |
from datasets import load_dataset
|
5 |
-
|
6 |
|
7 |
def normalize_example(example):
|
8 |
-
return {"source": example["input"],
|
9 |
-
"target": example["output"],
|
10 |
-
"id": example["id"],
|
11 |
-
"pid": example["pid"]}
|
12 |
|
13 |
|
14 |
def main(dataset_name, num_proc=5):
|
15 |
dataset = load_dataset("tau/scrolls", dataset_name)
|
16 |
-
dataset = dataset.map(normalize_example, num_proc=num_proc)
|
|
|
17 |
dir_name = f"../data/{dataset_name}"
|
18 |
os.makedirs(dir_name, exist_ok=True)
|
19 |
for split in dataset:
|
|
|
2 |
import shutil
|
3 |
from fire import Fire
|
4 |
from datasets import load_dataset
|
5 |
+
from icecream import ic
|
6 |
|
7 |
def normalize_example(example):
|
8 |
+
return {"source": example["input"], "target": example["output"]}
|
|
|
|
|
|
|
9 |
|
10 |
|
11 |
def main(dataset_name, num_proc=5):
|
12 |
dataset = load_dataset("tau/scrolls", dataset_name)
|
13 |
+
dataset = dataset.map(normalize_example, num_proc=num_proc, remove_columns=["input", "output"])
|
14 |
+
ic(dataset_name, dataset["train"][0])
|
15 |
dir_name = f"../data/{dataset_name}"
|
16 |
os.makedirs(dir_name, exist_ok=True)
|
17 |
for split in dataset:
|