Support streaming

#2
by albertvillanova HF staff - opened
Files changed (1) hide show
  1. climate_fever.py +4 -5
climate_fever.py CHANGED
@@ -48,7 +48,7 @@ _HOMEPAGE = "http://climatefever.ai"
48
  _LICENSE = ""
49
 
50
  # url to dataset release on GitHub
51
- _URL = f"https://github.com/tdiggelm/climate-fever-dataset/archive/{_VERSION}.zip"
52
 
53
 
54
  class ClimateFever(datasets.GeneratorBasedBuilder):
@@ -95,17 +95,16 @@ class ClimateFever(datasets.GeneratorBasedBuilder):
95
 
96
  def _split_generators(self, dl_manager):
97
  """Returns SplitGenerators."""
98
- data_dir = dl_manager.download_and_extract(_URL)
99
- data_dir = os.path.join(data_dir, f"climate-fever-dataset-{_VERSION}", "dataset")
100
  return [
101
  datasets.SplitGenerator(
102
  name=datasets.Split.TEST,
103
  # These kwargs will be passed to _generate_examples
104
- gen_kwargs={"filepath": os.path.join(data_dir, "climate-fever.jsonl"), "split": "test"},
105
  ),
106
  ]
107
 
108
- def _generate_examples(self, filepath, split):
109
  """Yields examples."""
110
  with open(filepath, encoding="utf-8") as f:
111
  for id_, row in enumerate(f):
 
48
  _LICENSE = ""
49
 
50
  # url to dataset release on GitHub
51
+ _URL = f"https://raw.githubusercontent.com/tdiggelm/climate-fever-dataset/{_VERSION}/dataset/climate-fever.jsonl"
52
 
53
 
54
  class ClimateFever(datasets.GeneratorBasedBuilder):
 
95
 
96
  def _split_generators(self, dl_manager):
97
  """Returns SplitGenerators."""
98
+ data_path = dl_manager.download(_URL)
 
99
  return [
100
  datasets.SplitGenerator(
101
  name=datasets.Split.TEST,
102
  # These kwargs will be passed to _generate_examples
103
+ gen_kwargs={"filepath": data_path},
104
  ),
105
  ]
106
 
107
+ def _generate_examples(self, filepath):
108
  """Yields examples."""
109
  with open(filepath, encoding="utf-8") as f:
110
  for id_, row in enumerate(f):