Convert dataset to Parquet
#4
by
rishabbala
- opened
- README.md +14 -5
- data/test-00000-of-00001.parquet +3 -0
- data/train-00000-of-00001.parquet +3 -0
- data/validation-00000-of-00001.parquet +3 -0
- wiqa.py +0 -113
README.md
CHANGED
@@ -31,16 +31,25 @@ dataset_info:
|
|
31 |
dtype: int32
|
32 |
splits:
|
33 |
- name: train
|
34 |
-
num_bytes:
|
35 |
num_examples: 29808
|
36 |
- name: test
|
37 |
-
num_bytes:
|
38 |
num_examples: 3003
|
39 |
- name: validation
|
40 |
-
num_bytes:
|
41 |
num_examples: 6894
|
42 |
-
download_size:
|
43 |
-
dataset_size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
---
|
45 |
|
46 |
# Dataset Card for "wiqa"
|
|
|
31 |
dtype: int32
|
32 |
splits:
|
33 |
- name: train
|
34 |
+
num_bytes: 16992007
|
35 |
num_examples: 29808
|
36 |
- name: test
|
37 |
+
num_bytes: 1522546
|
38 |
num_examples: 3003
|
39 |
- name: validation
|
40 |
+
num_bytes: 3757111
|
41 |
num_examples: 6894
|
42 |
+
download_size: 4248819
|
43 |
+
dataset_size: 22271664
|
44 |
+
configs:
|
45 |
+
- config_name: default
|
46 |
+
data_files:
|
47 |
+
- split: train
|
48 |
+
path: data/train-*
|
49 |
+
- split: test
|
50 |
+
path: data/test-*
|
51 |
+
- split: validation
|
52 |
+
path: data/validation-*
|
53 |
---
|
54 |
|
55 |
# Dataset Card for "wiqa"
|
data/test-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0af5d229a14369004f1edde21b97586307d85b9cdcd1d38e3de6440bc882e907
|
3 |
+
size 193432
|
data/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ed1ba14025996701297e83880caa824d3d4d579546728eeac8bdb891a2d902c9
|
3 |
+
size 3532349
|
data/validation-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f2dc03842e8a60767a6bc630b98219881cc04755b0498ee9dc1cea157b90e8bc
|
3 |
+
size 523038
|
wiqa.py
DELETED
@@ -1,113 +0,0 @@
|
|
1 |
-
"""TODO(wiqa): Add a description here."""
|
2 |
-
|
3 |
-
|
4 |
-
import json
|
5 |
-
import os
|
6 |
-
|
7 |
-
import datasets
|
8 |
-
|
9 |
-
|
10 |
-
# TODO(wiqa): BibTeX citation
|
11 |
-
_CITATION = """\
|
12 |
-
@article{wiqa,
|
13 |
-
author = {Niket Tandon and Bhavana Dalvi Mishra and Keisuke Sakaguchi and Antoine Bosselut and Peter Clark}
|
14 |
-
title = {WIQA: A dataset for "What if..." reasoning over procedural text},
|
15 |
-
journal = {arXiv:1909.04739v1},
|
16 |
-
year = {2019},
|
17 |
-
}
|
18 |
-
"""
|
19 |
-
|
20 |
-
# TODO(wiqa):
|
21 |
-
_DESCRIPTION = """\
|
22 |
-
The WIQA dataset V1 has 39705 questions containing a perturbation and a possible effect in the context of a paragraph.
|
23 |
-
The dataset is split into 29808 train questions, 6894 dev questions and 3003 test questions.
|
24 |
-
"""
|
25 |
-
_URL = "https://public-aristo-processes.s3-us-west-2.amazonaws.com/wiqa_dataset_no_explanation_v2/wiqa-dataset-v2-october-2019.zip"
|
26 |
-
URl = "s3://ai2-s2-research-public/open-corpus/2020-04-10/"
|
27 |
-
|
28 |
-
|
29 |
-
class Wiqa(datasets.GeneratorBasedBuilder):
|
30 |
-
"""TODO(wiqa): Short description of my dataset."""
|
31 |
-
|
32 |
-
# TODO(wiqa): Set up version.
|
33 |
-
VERSION = datasets.Version("0.1.0")
|
34 |
-
|
35 |
-
def _info(self):
|
36 |
-
# TODO(wiqa): Specifies the datasets.DatasetInfo object
|
37 |
-
return datasets.DatasetInfo(
|
38 |
-
# This is the description that will appear on the datasets page.
|
39 |
-
description=_DESCRIPTION,
|
40 |
-
# datasets.features.FeatureConnectors
|
41 |
-
features=datasets.Features(
|
42 |
-
{
|
43 |
-
# These are the features of your dataset like images, labels ...
|
44 |
-
"question_stem": datasets.Value("string"),
|
45 |
-
"question_para_step": datasets.features.Sequence(datasets.Value("string")),
|
46 |
-
"answer_label": datasets.Value("string"),
|
47 |
-
"answer_label_as_choice": datasets.Value("string"),
|
48 |
-
"choices": datasets.features.Sequence(
|
49 |
-
{"text": datasets.Value("string"), "label": datasets.Value("string")}
|
50 |
-
),
|
51 |
-
"metadata_question_id": datasets.Value("string"),
|
52 |
-
"metadata_graph_id": datasets.Value("string"),
|
53 |
-
"metadata_para_id": datasets.Value("string"),
|
54 |
-
"metadata_question_type": datasets.Value("string"),
|
55 |
-
"metadata_path_len": datasets.Value("int32"),
|
56 |
-
}
|
57 |
-
),
|
58 |
-
# If there's a common (input, target) tuple from the features,
|
59 |
-
# specify them here. They'll be used if as_supervised=True in
|
60 |
-
# builder.as_dataset.
|
61 |
-
supervised_keys=None,
|
62 |
-
# Homepage of the dataset for documentation
|
63 |
-
homepage="https://allenai.org/data/wiqa",
|
64 |
-
citation=_CITATION,
|
65 |
-
)
|
66 |
-
|
67 |
-
def _split_generators(self, dl_manager):
|
68 |
-
"""Returns SplitGenerators."""
|
69 |
-
# TODO(wiqa): Downloads the data and defines the splits
|
70 |
-
# dl_manager is a datasets.download.DownloadManager that can be used to
|
71 |
-
# download and extract URLs
|
72 |
-
dl_dir = dl_manager.download_and_extract(_URL)
|
73 |
-
|
74 |
-
return [
|
75 |
-
datasets.SplitGenerator(
|
76 |
-
name=datasets.Split.TRAIN,
|
77 |
-
# These kwargs will be passed to _generate_examples
|
78 |
-
gen_kwargs={"filepath": os.path.join(dl_dir, "train.jsonl")},
|
79 |
-
),
|
80 |
-
datasets.SplitGenerator(
|
81 |
-
name=datasets.Split.TEST,
|
82 |
-
# These kwargs will be passed to _generate_examples
|
83 |
-
gen_kwargs={"filepath": os.path.join(dl_dir, "test.jsonl")},
|
84 |
-
),
|
85 |
-
datasets.SplitGenerator(
|
86 |
-
name=datasets.Split.VALIDATION,
|
87 |
-
# These kwargs will be passed to _generate_examples
|
88 |
-
gen_kwargs={"filepath": os.path.join(dl_dir, "dev.jsonl")},
|
89 |
-
),
|
90 |
-
]
|
91 |
-
|
92 |
-
def _generate_examples(self, filepath):
|
93 |
-
"""Yields examples."""
|
94 |
-
# TODO(wiqa): Yields (key, example) tuples from the dataset
|
95 |
-
with open(filepath, encoding="utf-8") as f:
|
96 |
-
for id_, row in enumerate(f):
|
97 |
-
data = json.loads(row)
|
98 |
-
|
99 |
-
yield id_, {
|
100 |
-
"question_stem": data["question"]["stem"],
|
101 |
-
"question_para_step": data["question"]["para_steps"],
|
102 |
-
"answer_label": data["question"]["answer_label"],
|
103 |
-
"answer_label_as_choice": data["question"]["answer_label_as_choice"],
|
104 |
-
"choices": {
|
105 |
-
"text": [choice["text"] for choice in data["question"]["choices"]],
|
106 |
-
"label": [choice["label"] for choice in data["question"]["choices"]],
|
107 |
-
},
|
108 |
-
"metadata_question_id": data["metadata"]["ques_id"],
|
109 |
-
"metadata_graph_id": data["metadata"]["graph_id"],
|
110 |
-
"metadata_para_id": data["metadata"]["para_id"],
|
111 |
-
"metadata_question_type": data["metadata"]["question_type"],
|
112 |
-
"metadata_path_len": data["metadata"]["path_len"],
|
113 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|