SpeedOfMagic commited on
Commit
0e6dc0c
·
verified ·
1 Parent(s): ea7b41d

Update polygraph_xsum.py

Browse files
Files changed (1) hide show
  1. polygraph_xsum.py +4 -5
polygraph_xsum.py CHANGED
@@ -46,7 +46,7 @@ class PolygraphXsum(datasets.GeneratorBasedBuilder):
46
  split = src_url
47
  x, y = _prepare_dataset(dataset[split])
48
  result_dataset = datasets.Dataset.from_dict({"input": x, "output": y})
49
- result_dataset.to_json(dst_path)
50
  downloaded_files = dl_manager.download_custom({split: split for split in _CONFIG["splits"]}, download_custom_dataset)
51
 
52
  return [
@@ -68,7 +68,6 @@ class PolygraphXsum(datasets.GeneratorBasedBuilder):
68
  ]
69
 
70
  def _generate_examples(self, filepath):
71
- with open(filepath, encoding="utf-8") as f:
72
- dataset = datasets.Dataset.from_json(f.read())
73
- for i in range(len(item)):
74
- yield i, dataset[i]
 
46
  split = src_url
47
  x, y = _prepare_dataset(dataset[split])
48
  result_dataset = datasets.Dataset.from_dict({"input": x, "output": y})
49
+ result_dataset.save_to_disk(dst_path)
50
  downloaded_files = dl_manager.download_custom({split: split for split in _CONFIG["splits"]}, download_custom_dataset)
51
 
52
  return [
 
68
  ]
69
 
70
  def _generate_examples(self, filepath):
71
+ dataset = datasets.Dataset.load_from_disk(filepath)
72
+ for i in range(len(item)):
73
+ yield i, dataset[i]