Commit
·
386f224
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
- qa_zre.py +100 -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": "A dataset reducing relation extraction to simple reading comprehension questions\n", "citation": "@inproceedings{levy-etal-2017-zero,\n title = \"Zero-Shot Relation Extraction via Reading Comprehension\",\n author = \"Levy, Omer and\n Seo, Minjoon and\n Choi, Eunsol and\n Zettlemoyer, Luke\",\n booktitle = \"Proceedings of the 21st Conference on Computational Natural Language Learning ({C}o{NLL} 2017)\",\n month = aug,\n year = \"2017\",\n address = \"Vancouver, Canada\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/K17-1034\",\n doi = \"10.18653/v1/K17-1034\",\n pages = \"333--342\",\n}\n", "homepage": "http://nlp.cs.washington.edu/zeroshot", "license": "", "features": {"relation": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "subject": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "qa_zre", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 29410194, "num_examples": 120000, "dataset_name": "qa_zre"}, "validation": {"name": "validation", "num_bytes": 1481430, "num_examples": 6000, "dataset_name": "qa_zre"}, "train": {"name": "train", "num_bytes": 2054954011, "num_examples": 8400000, "dataset_name": "qa_zre"}}, "download_checksums": {"http://nlp.cs.washington.edu/zeroshot/relation_splits.tar.bz2": {"num_bytes": 516061636, "checksum": "e33d0e367b6e837370da17a2d09d217e0a92f8d180f7abb3fd543a2d1726b2b4"}}, "download_size": 516061636, "dataset_size": 2085845635, "size_in_bytes": 2601907271}}
|
dummy/0.1.0/dummy_data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4bcada04416b17bd18bb40d960aa6133a93e5e03de793b8c218672e7eb607e81
|
| 3 |
+
size 10404
|
qa_zre.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A dataset reducing relation extraction to simple reading comprehension questions"""
|
| 2 |
+
from __future__ import absolute_import, division, print_function
|
| 3 |
+
|
| 4 |
+
import csv
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
import datasets
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
_CITATION = """\
|
| 11 |
+
@inproceedings{levy-etal-2017-zero,
|
| 12 |
+
title = "Zero-Shot Relation Extraction via Reading Comprehension",
|
| 13 |
+
author = "Levy, Omer and
|
| 14 |
+
Seo, Minjoon and
|
| 15 |
+
Choi, Eunsol and
|
| 16 |
+
Zettlemoyer, Luke",
|
| 17 |
+
booktitle = "Proceedings of the 21st Conference on Computational Natural Language Learning ({C}o{NLL} 2017)",
|
| 18 |
+
month = aug,
|
| 19 |
+
year = "2017",
|
| 20 |
+
address = "Vancouver, Canada",
|
| 21 |
+
publisher = "Association for Computational Linguistics",
|
| 22 |
+
url = "https://www.aclweb.org/anthology/K17-1034",
|
| 23 |
+
doi = "10.18653/v1/K17-1034",
|
| 24 |
+
pages = "333--342",
|
| 25 |
+
}
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
_DESCRIPTION = """\
|
| 29 |
+
A dataset reducing relation extraction to simple reading comprehension questions
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
_DATA_URL = "http://nlp.cs.washington.edu/zeroshot/relation_splits.tar.bz2"
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class QaZre(datasets.GeneratorBasedBuilder):
|
| 36 |
+
"""QA-ZRE: Reducing relation extraction to simple reading comprehension questions"""
|
| 37 |
+
|
| 38 |
+
VERSION = datasets.Version("0.1.0")
|
| 39 |
+
|
| 40 |
+
def _info(self):
|
| 41 |
+
return datasets.DatasetInfo(
|
| 42 |
+
description=_DESCRIPTION,
|
| 43 |
+
features=datasets.Features(
|
| 44 |
+
{
|
| 45 |
+
"relation": datasets.Value("string"),
|
| 46 |
+
"question": datasets.Value("string"),
|
| 47 |
+
"subject": datasets.Value("string"),
|
| 48 |
+
"context": datasets.Value("string"),
|
| 49 |
+
"answers": datasets.features.Sequence(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="http://nlp.cs.washington.edu/zeroshot",
|
| 58 |
+
citation=_CITATION,
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
def _split_generators(self, dl_manager):
|
| 62 |
+
"""Returns SplitGenerators."""
|
| 63 |
+
dl_dir = dl_manager.download_and_extract(_DATA_URL)
|
| 64 |
+
dl_dir = os.path.join(dl_dir, "relation_splits")
|
| 65 |
+
|
| 66 |
+
return [
|
| 67 |
+
datasets.SplitGenerator(
|
| 68 |
+
name=datasets.Split.TEST,
|
| 69 |
+
gen_kwargs={
|
| 70 |
+
"filepaths": [os.path.join(dl_dir, "test." + str(i)) for i in range(10)],
|
| 71 |
+
},
|
| 72 |
+
),
|
| 73 |
+
datasets.SplitGenerator(
|
| 74 |
+
name=datasets.Split.VALIDATION,
|
| 75 |
+
gen_kwargs={
|
| 76 |
+
"filepaths": [os.path.join(dl_dir, "dev." + str(i)) for i in range(10)],
|
| 77 |
+
},
|
| 78 |
+
),
|
| 79 |
+
datasets.SplitGenerator(
|
| 80 |
+
name=datasets.Split.TRAIN,
|
| 81 |
+
gen_kwargs={
|
| 82 |
+
"filepaths": [os.path.join(dl_dir, "train." + str(i)) for i in range(10)],
|
| 83 |
+
},
|
| 84 |
+
),
|
| 85 |
+
]
|
| 86 |
+
|
| 87 |
+
def _generate_examples(self, filepaths):
|
| 88 |
+
"""Yields examples."""
|
| 89 |
+
|
| 90 |
+
for filepath in filepaths:
|
| 91 |
+
with open(filepath, encoding="utf-8") as f:
|
| 92 |
+
data = csv.reader(f, delimiter="\t")
|
| 93 |
+
for idx, row in enumerate(data):
|
| 94 |
+
yield idx, {
|
| 95 |
+
"relation": row[0],
|
| 96 |
+
"question": row[1],
|
| 97 |
+
"subject": row[2],
|
| 98 |
+
"context": row[3],
|
| 99 |
+
"answers": row[4:],
|
| 100 |
+
}
|