Fraser-Greenlee
commited on
Commit
·
e52d34d
1
Parent(s):
862bd18
add mini option
Browse files- python-state-changes.py +7 -6
python-state-changes.py
CHANGED
@@ -15,7 +15,10 @@ _FEATURES = datasets.Features(
|
|
15 |
"end": datasets.Value("string"),
|
16 |
}
|
17 |
)
|
18 |
-
_DATA_URL =
|
|
|
|
|
|
|
19 |
_LICENSE = "MIT License"
|
20 |
|
21 |
|
@@ -39,16 +42,14 @@ class PythonStateChanges(datasets.GeneratorBasedBuilder):
|
|
39 |
)
|
40 |
|
41 |
def _split_generators(self, dl_manager):
|
42 |
-
data_path = dl_manager.download(_DATA_URL)
|
43 |
return [
|
44 |
datasets.SplitGenerator(
|
45 |
-
name=datasets.Split.TRAIN, gen_kwargs={'path': data_path
|
46 |
),
|
47 |
]
|
48 |
|
49 |
-
def _generate_examples(self, path
|
50 |
with open(path, 'r', encoding="utf-8") as f:
|
51 |
for id_, line in enumerate(f):
|
52 |
yield id_, json.loads(line)
|
53 |
-
if id_ >= maxsize:
|
54 |
-
break
|
|
|
15 |
"end": datasets.Value("string"),
|
16 |
}
|
17 |
)
|
18 |
+
_DATA_URL = {
|
19 |
+
'default': "https://huggingface.co/datasets/Fraser/python-state-changes/resolve/main/data.jsonl",
|
20 |
+
'mini': "https://huggingface.co/datasets/Fraser/python-state-changes/resolve/main/data.mini.jsonl"
|
21 |
+
}
|
22 |
_LICENSE = "MIT License"
|
23 |
|
24 |
|
|
|
42 |
)
|
43 |
|
44 |
def _split_generators(self, dl_manager):
|
45 |
+
data_path = dl_manager.download(_DATA_URL[self.config.name])
|
46 |
return [
|
47 |
datasets.SplitGenerator(
|
48 |
+
name=datasets.Split.TRAIN, gen_kwargs={'path': data_path}
|
49 |
),
|
50 |
]
|
51 |
|
52 |
+
def _generate_examples(self, path):
|
53 |
with open(path, 'r', encoding="utf-8") as f:
|
54 |
for id_, line in enumerate(f):
|
55 |
yield id_, json.loads(line)
|
|
|
|