Commit
•
2017597
0
Parent(s):
Update files from the datasets library (from 1.0.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.0.0
- .gitattributes +27 -0
- dataset_infos.json +1 -0
- dummy/0.1.0/dummy_data.zip +3 -0
- quoref.py +117 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"default": {"description": "Quoref is a QA dataset which tests the coreferential reasoning capability of reading comprehension systems. In this \nspan-selection benchmark containing 24K questions over 4.7K paragraphs from Wikipedia, a system must resolve hard \ncoreferences before selecting the appropriate span(s) in the paragraphs for answering questions.\n", "citation": "@article{allenai:quoref,\n author = {Pradeep Dasigi and Nelson F. Liu and Ana Marasovic and Noah A. Smith and Matt Gardner},\n title = {Quoref: A Reading Comprehension Dataset with Questions Requiring Coreferential Reasoning},\n journal = {arXiv:1908.05803v2 },\n year = {2019},\n}\n", "homepage": "https://leaderboard.allenai.org/quoref/submissions/get-started", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "url": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"answer_start": {"dtype": "int32", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "quoref", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 44377729, "num_examples": 19399, "dataset_name": "quoref"}, "validation": {"name": "validation", "num_bytes": 5442031, "num_examples": 2418, "dataset_name": "quoref"}}, "download_checksums": {"https://quoref-dataset.s3-us-west-2.amazonaws.com/train_and_dev/quoref-train-dev-v0.1.zip": {"num_bytes": 5078438, "checksum": "aacde0863c04ba6e9ab46995ea844a5b0c6cea58a77ab6fd86a128e33a3ad8fb"}}, "download_size": 5078438, "dataset_size": 49819760, "size_in_bytes": 54898198}}
|
dummy/0.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:35eec734b230b1170f1ceb3eeea5d7bb789f6213004082c2e19f3e75fb898ba9
|
3 |
+
size 3274
|
quoref.py
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""TODO(quoref): Add a description here."""
|
2 |
+
|
3 |
+
from __future__ import absolute_import, division, print_function
|
4 |
+
|
5 |
+
import json
|
6 |
+
import os
|
7 |
+
|
8 |
+
import datasets
|
9 |
+
|
10 |
+
|
11 |
+
# TODO(quoref): BibTeX citation
|
12 |
+
_CITATION = """\
|
13 |
+
@article{allenai:quoref,
|
14 |
+
author = {Pradeep Dasigi and Nelson F. Liu and Ana Marasovic and Noah A. Smith and Matt Gardner},
|
15 |
+
title = {Quoref: A Reading Comprehension Dataset with Questions Requiring Coreferential Reasoning},
|
16 |
+
journal = {arXiv:1908.05803v2 },
|
17 |
+
year = {2019},
|
18 |
+
}
|
19 |
+
"""
|
20 |
+
|
21 |
+
# TODO(quoref):
|
22 |
+
_DESCRIPTION = """\
|
23 |
+
Quoref is a QA dataset which tests the coreferential reasoning capability of reading comprehension systems. In this
|
24 |
+
span-selection benchmark containing 24K questions over 4.7K paragraphs from Wikipedia, a system must resolve hard
|
25 |
+
coreferences before selecting the appropriate span(s) in the paragraphs for answering questions.
|
26 |
+
"""
|
27 |
+
|
28 |
+
_URL = "https://quoref-dataset.s3-us-west-2.amazonaws.com/train_and_dev/quoref-train-dev-v0.1.zip"
|
29 |
+
|
30 |
+
|
31 |
+
class Quoref(datasets.GeneratorBasedBuilder):
|
32 |
+
"""TODO(quoref): Short description of my dataset."""
|
33 |
+
|
34 |
+
# TODO(quoref): Set up version.
|
35 |
+
VERSION = datasets.Version("0.1.0")
|
36 |
+
|
37 |
+
def _info(self):
|
38 |
+
# TODO(quoref): Specifies the datasets.DatasetInfo object
|
39 |
+
return datasets.DatasetInfo(
|
40 |
+
# This is the description that will appear on the datasets page.
|
41 |
+
description=_DESCRIPTION,
|
42 |
+
# datasets.features.FeatureConnectors
|
43 |
+
features=datasets.Features(
|
44 |
+
{
|
45 |
+
"id": datasets.Value("string"),
|
46 |
+
"question": datasets.Value("string"),
|
47 |
+
"context": datasets.Value("string"),
|
48 |
+
"title": datasets.Value("string"),
|
49 |
+
"url": datasets.Value("string"),
|
50 |
+
"answers": datasets.features.Sequence(
|
51 |
+
{
|
52 |
+
"answer_start": datasets.Value("int32"),
|
53 |
+
"text": datasets.Value("string"),
|
54 |
+
}
|
55 |
+
)
|
56 |
+
# These are the features of your dataset like images, labels ...
|
57 |
+
}
|
58 |
+
),
|
59 |
+
# If there's a common (input, target) tuple from the features,
|
60 |
+
# specify them here. They'll be used if as_supervised=True in
|
61 |
+
# builder.as_dataset.
|
62 |
+
supervised_keys=None,
|
63 |
+
# Homepage of the dataset for documentation
|
64 |
+
homepage="https://leaderboard.allenai.org/quoref/submissions/get-started",
|
65 |
+
citation=_CITATION,
|
66 |
+
)
|
67 |
+
|
68 |
+
def _split_generators(self, dl_manager):
|
69 |
+
"""Returns SplitGenerators."""
|
70 |
+
# TODO(quoref): Downloads the data and defines the splits
|
71 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to
|
72 |
+
# download and extract URLs
|
73 |
+
dl_dir = dl_manager.download_and_extract(_URL)
|
74 |
+
data_dir = os.path.join(dl_dir, "quoref-train-dev-v0.1")
|
75 |
+
return [
|
76 |
+
datasets.SplitGenerator(
|
77 |
+
name=datasets.Split.TRAIN,
|
78 |
+
# These kwargs will be passed to _generate_examples
|
79 |
+
gen_kwargs={"filepath": os.path.join(data_dir, "quoref-train-v0.1.json")},
|
80 |
+
),
|
81 |
+
datasets.SplitGenerator(
|
82 |
+
name=datasets.Split.VALIDATION,
|
83 |
+
# These kwargs will be passed to _generate_examples
|
84 |
+
gen_kwargs={"filepath": os.path.join(data_dir, "quoref-dev-v0.1.json")},
|
85 |
+
),
|
86 |
+
]
|
87 |
+
|
88 |
+
def _generate_examples(self, filepath):
|
89 |
+
"""Yields examples."""
|
90 |
+
# TODO(quoref): Yields (key, example) tuples from the dataset
|
91 |
+
with open(filepath, encoding="utf-8") as f:
|
92 |
+
data = json.load(f)
|
93 |
+
for article in data["data"]:
|
94 |
+
title = article.get("title", "").strip()
|
95 |
+
url = article.get("url", "").strip()
|
96 |
+
for paragraph in article["paragraphs"]:
|
97 |
+
context = paragraph["context"].strip()
|
98 |
+
for qa in paragraph["qas"]:
|
99 |
+
question = qa["question"].strip()
|
100 |
+
id_ = qa["id"]
|
101 |
+
|
102 |
+
answer_starts = [answer["answer_start"] for answer in qa["answers"]]
|
103 |
+
answers = [answer["text"].strip() for answer in qa["answers"]]
|
104 |
+
|
105 |
+
# Features currently used are "context", "question", and "answers".
|
106 |
+
# Others are extracted here for the ease of future expansions.
|
107 |
+
yield id_, {
|
108 |
+
"title": title,
|
109 |
+
"context": context,
|
110 |
+
"question": question,
|
111 |
+
"id": id_,
|
112 |
+
"answers": {
|
113 |
+
"answer_start": answer_starts,
|
114 |
+
"text": answers,
|
115 |
+
},
|
116 |
+
"url": url,
|
117 |
+
}
|