Update polygraph_xsum.py
Browse files- polygraph_xsum.py +5 -3
polygraph_xsum.py
CHANGED
|
@@ -11,12 +11,14 @@ _DATA_DIRECTORY = "."
|
|
| 11 |
VERSION = datasets.Version("0.0.1")
|
| 12 |
_SPLITS = ["train", "validation", "test"]
|
| 13 |
_CONFIG = {
|
| 14 |
-
"dataset": "xsum"
|
|
|
|
|
|
|
| 15 |
}
|
| 16 |
|
| 17 |
|
| 18 |
def _prepare_dataset(dataset):
|
| 19 |
-
return dataset["
|
| 20 |
|
| 21 |
|
| 22 |
class PolygraphXsum(datasets.GeneratorBasedBuilder):
|
|
@@ -41,7 +43,7 @@ class PolygraphXsum(datasets.GeneratorBasedBuilder):
|
|
| 41 |
|
| 42 |
def download_custom_dataset(src_url: str, dst_path: str):
|
| 43 |
split = src_url
|
| 44 |
-
x, y = _prepare_dataset(dataset)
|
| 45 |
result_dataset = Dataset.from_dict({"input": x, "output": y})
|
| 46 |
result_dataset.to_json(dst_path)
|
| 47 |
downloaded_files = dl_manager.download_custom(_SPLITS, download_custom_dataset)
|
|
|
|
| 11 |
VERSION = datasets.Version("0.0.1")
|
| 12 |
_SPLITS = ["train", "validation", "test"]
|
| 13 |
_CONFIG = {
|
| 14 |
+
"dataset": "xsum",
|
| 15 |
+
"input_column": "document",
|
| 16 |
+
"output_column": "summary",
|
| 17 |
}
|
| 18 |
|
| 19 |
|
| 20 |
def _prepare_dataset(dataset):
|
| 21 |
+
return dataset[_CONFIG["input_column"]], dataset[_CONFIG["output_column"]]
|
| 22 |
|
| 23 |
|
| 24 |
class PolygraphXsum(datasets.GeneratorBasedBuilder):
|
|
|
|
| 43 |
|
| 44 |
def download_custom_dataset(src_url: str, dst_path: str):
|
| 45 |
split = src_url
|
| 46 |
+
x, y = _prepare_dataset(dataset[split])
|
| 47 |
result_dataset = Dataset.from_dict({"input": x, "output": y})
|
| 48 |
result_dataset.to_json(dst_path)
|
| 49 |
downloaded_files = dl_manager.download_custom(_SPLITS, download_custom_dataset)
|