Commit
•
9012d0d
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.1/dummy_data.zip +3 -0
- eraser_multi_rc.py +119 -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": "\nEraser Multi RC is a dataset for queries over multi-line passages, along with\nanswers and a rationalte. Each example in this dataset has the following 5 parts\n1. A Mutli-line Passage\n2. A Query about the passage\n3. An Answer to the query\n4. A Classification as to whether the answer is right or wrong\n5. An Explanation justifying the classification\n", "citation": "\n@unpublished{eraser2019,\n title = {ERASER: A Benchmark to Evaluate Rationalized NLP Models},\n author = {Jay DeYoung and Sarthak Jain and Nazneen Fatema Rajani and Eric Lehman and Caiming Xiong and Richard Socher and Byron C. Wallace}\n}\n@inproceedings{MultiRC2018,\n author = {Daniel Khashabi and Snigdha Chaturvedi and Michael Roth and Shyam Upadhyay and Dan Roth},\n title = {Looking Beyond the Surface:A Challenge Set for Reading Comprehension over Multiple Sentences},\n booktitle = {NAACL},\n year = {2018}\n}\n", "homepage": "https://cogcomp.seas.upenn.edu/multirc/", "license": "", "features": {"passage": {"dtype": "string", "id": null, "_type": "Value"}, "query_and_answer": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 2, "names": ["False", "True"], "names_file": null, "id": null, "_type": "ClassLabel"}, "evidences": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "eraser_multi_rc", "config_name": "default", "version": {"version_str": "0.1.1", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 1}, "splits": {"test": {"name": "test", "num_bytes": 9194475, "num_examples": 4848, "dataset_name": "eraser_multi_rc"}, "train": {"name": "train", "num_bytes": 47922877, "num_examples": 24029, "dataset_name": "eraser_multi_rc"}, "validation": {"name": "validation", "num_bytes": 6529020, "num_examples": 3214, "dataset_name": "eraser_multi_rc"}}, "download_checksums": {"http://www.eraserbenchmark.com/zipped/multirc.tar.gz": {"num_bytes": 1667550, "checksum": "7d3364fad630d0949b40cc5c4b9fd7fac0ec9ebb3a31ffa92a491e3883edd826"}}, "download_size": 1667550, "dataset_size": 63646372, "size_in_bytes": 65313922}}
|
dummy/0.1.1/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6586ebece48eaf697b40cf5a630c45080bcd499649b7d4aaae216e327e16c194
|
3 |
+
size 8216
|
eraser_multi_rc.py
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
|
16 |
+
# Lint as: python3
|
17 |
+
"""Passage, query, answers and answer classification with explanations."""
|
18 |
+
|
19 |
+
from __future__ import absolute_import, division, print_function
|
20 |
+
|
21 |
+
import json
|
22 |
+
import os
|
23 |
+
|
24 |
+
import datasets
|
25 |
+
|
26 |
+
|
27 |
+
_CITATION = """
|
28 |
+
@unpublished{eraser2019,
|
29 |
+
title = {ERASER: A Benchmark to Evaluate Rationalized NLP Models},
|
30 |
+
author = {Jay DeYoung and Sarthak Jain and Nazneen Fatema Rajani and Eric Lehman and Caiming Xiong and Richard Socher and Byron C. Wallace}
|
31 |
+
}
|
32 |
+
@inproceedings{MultiRC2018,
|
33 |
+
author = {Daniel Khashabi and Snigdha Chaturvedi and Michael Roth and Shyam Upadhyay and Dan Roth},
|
34 |
+
title = {Looking Beyond the Surface:A Challenge Set for Reading Comprehension over Multiple Sentences},
|
35 |
+
booktitle = {NAACL},
|
36 |
+
year = {2018}
|
37 |
+
}
|
38 |
+
"""
|
39 |
+
|
40 |
+
_DESCRIPTION = """
|
41 |
+
Eraser Multi RC is a dataset for queries over multi-line passages, along with
|
42 |
+
answers and a rationalte. Each example in this dataset has the following 5 parts
|
43 |
+
1. A Mutli-line Passage
|
44 |
+
2. A Query about the passage
|
45 |
+
3. An Answer to the query
|
46 |
+
4. A Classification as to whether the answer is right or wrong
|
47 |
+
5. An Explanation justifying the classification
|
48 |
+
"""
|
49 |
+
|
50 |
+
_DOWNLOAD_URL = "http://www.eraserbenchmark.com/zipped/multirc.tar.gz"
|
51 |
+
|
52 |
+
|
53 |
+
class EraserMultiRc(datasets.GeneratorBasedBuilder):
|
54 |
+
"""Multi Sentence Reasoning with Explanations (Eraser Benchmark)."""
|
55 |
+
|
56 |
+
VERSION = datasets.Version("0.1.1")
|
57 |
+
|
58 |
+
def _info(self):
|
59 |
+
return datasets.DatasetInfo(
|
60 |
+
description=_DESCRIPTION,
|
61 |
+
features=datasets.Features(
|
62 |
+
{
|
63 |
+
"passage": datasets.Value("string"),
|
64 |
+
"query_and_answer": datasets.Value("string"),
|
65 |
+
"label": datasets.features.ClassLabel(names=["False", "True"]),
|
66 |
+
"evidences": datasets.features.Sequence(datasets.Value("string")),
|
67 |
+
}
|
68 |
+
),
|
69 |
+
supervised_keys=None,
|
70 |
+
homepage="https://cogcomp.seas.upenn.edu/multirc/",
|
71 |
+
citation=_CITATION,
|
72 |
+
)
|
73 |
+
|
74 |
+
def _split_generators(self, dl_manager):
|
75 |
+
"""Returns SplitGenerators."""
|
76 |
+
|
77 |
+
dl_dir = dl_manager.download_and_extract(_DOWNLOAD_URL)
|
78 |
+
data_dir = os.path.join(dl_dir, "multirc")
|
79 |
+
return [
|
80 |
+
datasets.SplitGenerator(
|
81 |
+
name=datasets.Split.TRAIN,
|
82 |
+
# These kwargs will be passed to _generate_examples
|
83 |
+
gen_kwargs={"data_dir": data_dir, "filepath": os.path.join(data_dir, "train.jsonl")},
|
84 |
+
),
|
85 |
+
datasets.SplitGenerator(
|
86 |
+
name=datasets.Split.VALIDATION,
|
87 |
+
# These kwargs will be passed to _generate_examples
|
88 |
+
gen_kwargs={"data_dir": data_dir, "filepath": os.path.join(data_dir, "val.jsonl")},
|
89 |
+
),
|
90 |
+
datasets.SplitGenerator(
|
91 |
+
name=datasets.Split.TEST,
|
92 |
+
# These kwargs will be passed to _generate_examples
|
93 |
+
gen_kwargs={"data_dir": data_dir, "filepath": os.path.join(data_dir, "test.jsonl")},
|
94 |
+
),
|
95 |
+
]
|
96 |
+
|
97 |
+
def _generate_examples(self, data_dir, filepath):
|
98 |
+
"""Yields examples."""
|
99 |
+
|
100 |
+
multirc_dir = os.path.join(data_dir, "docs")
|
101 |
+
with open(filepath, encoding="utf-8") as f:
|
102 |
+
for line in f:
|
103 |
+
row = json.loads(line)
|
104 |
+
evidences = []
|
105 |
+
|
106 |
+
for evidence in row["evidences"][0]:
|
107 |
+
docid = evidence["docid"]
|
108 |
+
evidences.append(evidence["text"])
|
109 |
+
|
110 |
+
passage_file = os.path.join(multirc_dir, docid)
|
111 |
+
with open(passage_file, encoding="utf-8") as f1:
|
112 |
+
passage_text = f1.read()
|
113 |
+
|
114 |
+
yield row["annotation_id"], {
|
115 |
+
"passage": passage_text,
|
116 |
+
"query_and_answer": row["query"],
|
117 |
+
"label": row["classification"],
|
118 |
+
"evidences": evidences,
|
119 |
+
}
|