Support streaming
#2
by
albertvillanova
HF staff
- opened
- 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://
|
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 |
-
|
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":
|
105 |
),
|
106 |
]
|
107 |
|
108 |
-
def _generate_examples(self, filepath
|
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):
|