emilnuutinen
commited on
Commit
•
c5b4836
1
Parent(s):
3b45c4a
Download & extract gzipped files instead of downloading full plain text files
Browse files- squad_v2_fi.py +11 -2
squad_v2_fi.py
CHANGED
@@ -9,6 +9,11 @@ combines the 100,000 questions in SQuAD1.1 with over 50,000 unanswerable questio
|
|
9 |
also determine when no answer is supported by the paragraph and abstain from answering.
|
10 |
"""
|
11 |
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
class SquadV2Config(datasets.BuilderConfig):
|
14 |
"""BuilderConfig for SQUAD."""
|
@@ -58,13 +63,17 @@ class SquadV2(datasets.GeneratorBasedBuilder):
|
|
58 |
def _split_generators(self, dl_manager):
|
59 |
"""Returns SplitGenerators."""
|
60 |
|
|
|
|
|
|
|
61 |
return [
|
62 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={
|
63 |
-
"filepath": "train
|
64 |
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={
|
65 |
-
"filepath": "dev
|
66 |
]
|
67 |
|
|
|
68 |
def _generate_examples(self, filepath):
|
69 |
"""Yields examples."""
|
70 |
with open(filepath, encoding="utf-8") as f:
|
|
|
9 |
also determine when no answer is supported by the paragraph and abstain from answering.
|
10 |
"""
|
11 |
|
12 |
+
_URLS = {
|
13 |
+
"train": "https://huggingface.co/datasets/TurkuNLP/squad_v2_fi/resolve/main/train-v2.0.json.gz",
|
14 |
+
"dev": "https://huggingface.co/datasets/TurkuNLP/squad_v2_fi/resolve/main/dev-v2.0.json.gz",
|
15 |
+
}
|
16 |
+
|
17 |
|
18 |
class SquadV2Config(datasets.BuilderConfig):
|
19 |
"""BuilderConfig for SQUAD."""
|
|
|
63 |
def _split_generators(self, dl_manager):
|
64 |
"""Returns SplitGenerators."""
|
65 |
|
66 |
+
urls_to_download = _URLS
|
67 |
+
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
68 |
+
|
69 |
return [
|
70 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={
|
71 |
+
"filepath": downloaded_files["train"]}),
|
72 |
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={
|
73 |
+
"filepath": downloaded_files["dev"]}),
|
74 |
]
|
75 |
|
76 |
+
|
77 |
def _generate_examples(self, filepath):
|
78 |
"""Yields examples."""
|
79 |
with open(filepath, encoding="utf-8") as f:
|