Convert dataset to Parquet (#4)
Browse files- Convert dataset to Parquet (2acdbe6f70432a9964b534280d3d21686641c6c3)
- Delete loading script (0aeb8208f9e7a34997495fb1fd1e237ba48c9b11)
- 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
- quarel.py +0 -102
README.md
CHANGED
|
@@ -23,16 +23,25 @@ dataset_info:
|
|
| 23 |
dtype: string
|
| 24 |
splits:
|
| 25 |
- name: train
|
| 26 |
-
num_bytes:
|
| 27 |
num_examples: 1941
|
| 28 |
- name: test
|
| 29 |
-
num_bytes:
|
| 30 |
num_examples: 552
|
| 31 |
- name: validation
|
| 32 |
-
num_bytes:
|
| 33 |
num_examples: 278
|
| 34 |
-
download_size:
|
| 35 |
-
dataset_size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
---
|
| 37 |
|
| 38 |
# Dataset Card for "quarel"
|
|
|
|
| 23 |
dtype: string
|
| 24 |
splits:
|
| 25 |
- name: train
|
| 26 |
+
num_bytes: 1069679
|
| 27 |
num_examples: 1941
|
| 28 |
- name: test
|
| 29 |
+
num_bytes: 306655
|
| 30 |
num_examples: 552
|
| 31 |
- name: validation
|
| 32 |
+
num_bytes: 153817
|
| 33 |
num_examples: 278
|
| 34 |
+
download_size: 487676
|
| 35 |
+
dataset_size: 1530151
|
| 36 |
+
configs:
|
| 37 |
+
- config_name: default
|
| 38 |
+
data_files:
|
| 39 |
+
- split: train
|
| 40 |
+
path: data/train-*
|
| 41 |
+
- split: test
|
| 42 |
+
path: data/test-*
|
| 43 |
+
- split: validation
|
| 44 |
+
path: data/validation-*
|
| 45 |
---
|
| 46 |
|
| 47 |
# Dataset Card for "quarel"
|
data/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b912daa32df88afec29bbdfb01529c2bfaf232792cccfe35fdcc74e8785c4e5a
|
| 3 |
+
size 104240
|
data/train-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d6c5e13b16a58857d2c04cf9af0e290bab4c3f46257eafae241b2186ba4bb19d
|
| 3 |
+
size 326198
|
data/validation-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f6d294cb57b167ae8e9e0e1ac34a4aae801feda0aac83765bb6117a0b7ef294d
|
| 3 |
+
size 57238
|
quarel.py
DELETED
|
@@ -1,102 +0,0 @@
|
|
| 1 |
-
"""TODO(quarel): Add a description here."""
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
import json
|
| 5 |
-
import os
|
| 6 |
-
|
| 7 |
-
import datasets
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
# TODO(quarel): BibTeX citation
|
| 11 |
-
_CITATION = """\
|
| 12 |
-
@inproceedings{quarel_v1,
|
| 13 |
-
title={QuaRel: A Dataset and Models for Answering Questions about Qualitative Relationships},
|
| 14 |
-
author={Oyvind Tafjord, Peter Clark, Matt Gardner, Wen-tau Yih, Ashish Sabharwal},
|
| 15 |
-
year={2018},
|
| 16 |
-
journal={arXiv:1805.05377v1}
|
| 17 |
-
}
|
| 18 |
-
"""
|
| 19 |
-
|
| 20 |
-
# TODO(quarel):
|
| 21 |
-
_DESCRIPTION = """
|
| 22 |
-
QuaRel is a crowdsourced dataset of 2771 multiple-choice story questions, including their logical forms.
|
| 23 |
-
"""
|
| 24 |
-
_URL = "https://s3-us-west-2.amazonaws.com/ai2-website/data/quarel-dataset-v1-nov2018.zip"
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
class Quarel(datasets.GeneratorBasedBuilder):
|
| 28 |
-
"""TODO(quarel): Short description of my dataset."""
|
| 29 |
-
|
| 30 |
-
# TODO(quarel): Set up version.
|
| 31 |
-
VERSION = datasets.Version("0.1.0")
|
| 32 |
-
|
| 33 |
-
def _info(self):
|
| 34 |
-
# TODO(quarel): Specifies the datasets.DatasetInfo object
|
| 35 |
-
return datasets.DatasetInfo(
|
| 36 |
-
# This is the description that will appear on the datasets page.
|
| 37 |
-
description=_DESCRIPTION,
|
| 38 |
-
# datasets.features.FeatureConnectors
|
| 39 |
-
features=datasets.Features(
|
| 40 |
-
{
|
| 41 |
-
# These are the features of your dataset like images, labels ...
|
| 42 |
-
"id": datasets.Value("string"),
|
| 43 |
-
"answer_index": datasets.Value("int32"),
|
| 44 |
-
"logical_forms": datasets.features.Sequence(datasets.Value("string")),
|
| 45 |
-
"logical_form_pretty": datasets.Value("string"),
|
| 46 |
-
"world_literals": datasets.features.Sequence(
|
| 47 |
-
{"world1": datasets.Value("string"), "world2": datasets.Value("string")}
|
| 48 |
-
),
|
| 49 |
-
"question": datasets.Value("string"),
|
| 50 |
-
}
|
| 51 |
-
),
|
| 52 |
-
# If there's a common (input, target) tuple from the features,
|
| 53 |
-
# specify them here. They'll be used if as_supervised=True in
|
| 54 |
-
# builder.as_dataset.
|
| 55 |
-
supervised_keys=None,
|
| 56 |
-
# Homepage of the dataset for documentation
|
| 57 |
-
homepage="https://allenai.org/data/quarel",
|
| 58 |
-
citation=_CITATION,
|
| 59 |
-
)
|
| 60 |
-
|
| 61 |
-
def _split_generators(self, dl_manager):
|
| 62 |
-
"""Returns SplitGenerators."""
|
| 63 |
-
# TODO(quarel): Downloads the data and defines the splits
|
| 64 |
-
# dl_manager is a datasets.download.DownloadManager that can be used to
|
| 65 |
-
# download and extract URLs
|
| 66 |
-
dl_dir = dl_manager.download_and_extract(_URL)
|
| 67 |
-
data_dir = os.path.join(dl_dir, "quarel-dataset-v1")
|
| 68 |
-
return [
|
| 69 |
-
datasets.SplitGenerator(
|
| 70 |
-
name=datasets.Split.TRAIN,
|
| 71 |
-
# These kwargs will be passed to _generate_examples
|
| 72 |
-
gen_kwargs={"filepath": os.path.join(data_dir, "quarel-v1-train.jsonl")},
|
| 73 |
-
),
|
| 74 |
-
datasets.SplitGenerator(
|
| 75 |
-
name=datasets.Split.TEST,
|
| 76 |
-
# These kwargs will be passed to _generate_examples
|
| 77 |
-
gen_kwargs={"filepath": os.path.join(data_dir, "quarel-v1-test.jsonl")},
|
| 78 |
-
),
|
| 79 |
-
datasets.SplitGenerator(
|
| 80 |
-
name=datasets.Split.VALIDATION,
|
| 81 |
-
# These kwargs will be passed to _generate_examples
|
| 82 |
-
gen_kwargs={"filepath": os.path.join(data_dir, "quarel-v1-dev.jsonl")},
|
| 83 |
-
),
|
| 84 |
-
]
|
| 85 |
-
|
| 86 |
-
def _generate_examples(self, filepath):
|
| 87 |
-
"""Yields examples."""
|
| 88 |
-
# TODO(quarel): Yields (key, example) tuples from the dataset
|
| 89 |
-
with open(filepath, encoding="utf-8") as f:
|
| 90 |
-
for id_, row in enumerate(f):
|
| 91 |
-
data = json.loads(row)
|
| 92 |
-
yield id_, {
|
| 93 |
-
"id": data["id"],
|
| 94 |
-
"answer_index": data["answer_index"],
|
| 95 |
-
"logical_forms": data["logical_forms"],
|
| 96 |
-
"world_literals": {
|
| 97 |
-
"world1": [data["world_literals"]["world1"]],
|
| 98 |
-
"world2": [data["world_literals"]["world2"]],
|
| 99 |
-
},
|
| 100 |
-
"logical_form_pretty": data["logical_form_pretty"],
|
| 101 |
-
"question": data["question"],
|
| 102 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|