Commit
·
3c220e2
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/medhop/1.0.0/dummy_data.zip +3 -0
- qangaroo.py +127 -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 |
+
{"medhop": {"description": " We have created two new Reading Comprehension datasets focussing on multi-hop (alias multi-step) inference.\n\nSeveral pieces of information often jointly imply another fact. In multi-hop inference, a new fact is derived by combining facts via a chain of multiple steps.\n\nOur aim is to build Reading Comprehension methods that perform multi-hop inference on text, where individual facts are spread out across different documents.\n\nThe two QAngaroo datasets provide a training and evaluation resource for such methods.\n", "citation": "\n", "homepage": "http://qangaroo.cs.ucl.ac.uk/index.html", "license": "", "features": {"query": {"dtype": "string", "id": null, "_type": "Value"}, "supports": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "candidates": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "qangaroo", "config_name": "medhop", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 93947725, "num_examples": 1620, "dataset_name": "qangaroo"}, "validation": {"name": "validation", "num_bytes": 16463555, "num_examples": 342, "dataset_name": "qangaroo"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=1ytVZ4AhubFDOEL7o7XrIRIyhU8g9wvKA": {"num_bytes": 339843061, "checksum": "2f512869760cdad76a022a1465f025b486ae79dc5b8f0bf3ad901a4caf2d3050"}}, "download_size": 339843061, "dataset_size": 110411280, "size_in_bytes": 450254341}, "masked_medhop": {"description": " We have created two new Reading Comprehension datasets focussing on multi-hop (alias multi-step) inference.\n\nSeveral pieces of information often jointly imply another fact. In multi-hop inference, a new fact is derived by combining facts via a chain of multiple steps.\n\nOur aim is to build Reading Comprehension methods that perform multi-hop inference on text, where individual facts are spread out across different documents.\n\nThe two QAngaroo datasets provide a training and evaluation resource for such methods.\n", "citation": "\n", "homepage": "http://qangaroo.cs.ucl.ac.uk/index.html", "license": "", "features": {"query": {"dtype": "string", "id": null, "_type": "Value"}, "supports": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "candidates": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "qangaroo", "config_name": "masked_medhop", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 95823986, "num_examples": 1620, "dataset_name": "qangaroo"}, "validation": {"name": "validation", "num_bytes": 16802484, "num_examples": 342, "dataset_name": "qangaroo"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=1ytVZ4AhubFDOEL7o7XrIRIyhU8g9wvKA": {"num_bytes": 339843061, "checksum": "2f512869760cdad76a022a1465f025b486ae79dc5b8f0bf3ad901a4caf2d3050"}}, "download_size": 339843061, "dataset_size": 112626470, "size_in_bytes": 452469531}, "wikihop": {"description": " We have created two new Reading Comprehension datasets focussing on multi-hop (alias multi-step) inference.\n\nSeveral pieces of information often jointly imply another fact. In multi-hop inference, a new fact is derived by combining facts via a chain of multiple steps.\n\nOur aim is to build Reading Comprehension methods that perform multi-hop inference on text, where individual facts are spread out across different documents.\n\nThe two QAngaroo datasets provide a training and evaluation resource for such methods.\n", "citation": "\n", "homepage": "http://qangaroo.cs.ucl.ac.uk/index.html", "license": "", "features": {"query": {"dtype": "string", "id": null, "_type": "Value"}, "supports": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "candidates": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "qangaroo", "config_name": "wikihop", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 325994029, "num_examples": 43738, "dataset_name": "qangaroo"}, "validation": {"name": "validation", "num_bytes": 40869634, "num_examples": 5129, "dataset_name": "qangaroo"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=1ytVZ4AhubFDOEL7o7XrIRIyhU8g9wvKA": {"num_bytes": 339843061, "checksum": "2f512869760cdad76a022a1465f025b486ae79dc5b8f0bf3ad901a4caf2d3050"}}, "download_size": 339843061, "dataset_size": 366863663, "size_in_bytes": 706706724}, "masked_wikihop": {"description": " We have created two new Reading Comprehension datasets focussing on multi-hop (alias multi-step) inference.\n\nSeveral pieces of information often jointly imply another fact. In multi-hop inference, a new fact is derived by combining facts via a chain of multiple steps.\n\nOur aim is to build Reading Comprehension methods that perform multi-hop inference on text, where individual facts are spread out across different documents.\n\nThe two QAngaroo datasets provide a training and evaluation resource for such methods.\n", "citation": "\n", "homepage": "http://qangaroo.cs.ucl.ac.uk/index.html", "license": "", "features": {"query": {"dtype": "string", "id": null, "_type": "Value"}, "supports": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "candidates": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "qangaroo", "config_name": "masked_wikihop", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 348290479, "num_examples": 43738, "dataset_name": "qangaroo"}, "validation": {"name": "validation", "num_bytes": 43689810, "num_examples": 5129, "dataset_name": "qangaroo"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=1ytVZ4AhubFDOEL7o7XrIRIyhU8g9wvKA": {"num_bytes": 339843061, "checksum": "2f512869760cdad76a022a1465f025b486ae79dc5b8f0bf3ad901a4caf2d3050"}}, "download_size": 339843061, "dataset_size": 391980289, "size_in_bytes": 731823350}}
|
dummy/medhop/1.0.0/dummy_data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e2d534d9b8533c365d90ab73565697864e70bad23f1a441194ebb40a31e647f
|
| 3 |
+
size 154091
|
qangaroo.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""TODO(qangaroo): 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(qangaroo): BibTeX citation
|
| 12 |
+
|
| 13 |
+
_CITATION = """
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
# TODO(quangaroo):
|
| 17 |
+
_DESCRIPTION = """\
|
| 18 |
+
We have created two new Reading Comprehension datasets focussing on multi-hop (alias multi-step) inference.
|
| 19 |
+
|
| 20 |
+
Several pieces of information often jointly imply another fact. In multi-hop inference, a new fact is derived by combining facts via a chain of multiple steps.
|
| 21 |
+
|
| 22 |
+
Our aim is to build Reading Comprehension methods that perform multi-hop inference on text, where individual facts are spread out across different documents.
|
| 23 |
+
|
| 24 |
+
The two QAngaroo datasets provide a training and evaluation resource for such methods.
|
| 25 |
+
"""
|
| 26 |
+
|
| 27 |
+
_MEDHOP_DESCRIPTION = """\
|
| 28 |
+
With the same format as WikiHop, this dataset is based on research paper abstracts from PubMed, and the queries are about interactions between pairs of drugs.
|
| 29 |
+
The correct answer has to be inferred by combining information from a chain of reactions of drugs and proteins.
|
| 30 |
+
"""
|
| 31 |
+
_WIKIHOP_DESCRIPTION = """\
|
| 32 |
+
With the same format as WikiHop, this dataset is based on research paper abstracts from PubMed, and the queries are about interactions between pairs of drugs.
|
| 33 |
+
The correct answer has to be inferred by combining information from a chain of reactions of drugs and proteins.
|
| 34 |
+
"""
|
| 35 |
+
|
| 36 |
+
_URL = "https://drive.google.com/uc?export=download&id=1ytVZ4AhubFDOEL7o7XrIRIyhU8g9wvKA"
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
class QangarooConfig(datasets.BuilderConfig):
|
| 40 |
+
def __init__(self, data_dir, **kwargs):
|
| 41 |
+
"""BuilderConfig for qangaroo dataset
|
| 42 |
+
|
| 43 |
+
Args:
|
| 44 |
+
data_dir: directory for the given dataset name
|
| 45 |
+
**kwargs: keyword arguments forwarded to super.
|
| 46 |
+
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
+
super(QangarooConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
| 50 |
+
|
| 51 |
+
self.data_dir = data_dir
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
class Qangaroo(datasets.GeneratorBasedBuilder):
|
| 55 |
+
"""TODO(qangaroo): Short description of my dataset."""
|
| 56 |
+
|
| 57 |
+
# TODO(qangaroo): Set up version.
|
| 58 |
+
VERSION = datasets.Version("0.1.0")
|
| 59 |
+
BUILDER_CONFIGS = [
|
| 60 |
+
QangarooConfig(name="medhop", description=_MEDHOP_DESCRIPTION, data_dir="medhop"),
|
| 61 |
+
QangarooConfig(name="masked_medhop", description=_MEDHOP_DESCRIPTION, data_dir="medhop"),
|
| 62 |
+
QangarooConfig(name="wikihop", description=_WIKIHOP_DESCRIPTION, data_dir="wikihop"),
|
| 63 |
+
QangarooConfig(name="masked_wikihop", description=_WIKIHOP_DESCRIPTION, data_dir="wikihop"),
|
| 64 |
+
]
|
| 65 |
+
|
| 66 |
+
def _info(self):
|
| 67 |
+
# TODO(qangaroo): Specifies the datasets.DatasetInfo object
|
| 68 |
+
return datasets.DatasetInfo(
|
| 69 |
+
# This is the description that will appear on the datasets page.
|
| 70 |
+
description=_DESCRIPTION,
|
| 71 |
+
# datasets.features.FeatureConnectors
|
| 72 |
+
features=datasets.Features(
|
| 73 |
+
{
|
| 74 |
+
# These are the features of your dataset like images, labels ...
|
| 75 |
+
"query": datasets.Value("string"),
|
| 76 |
+
"supports": datasets.features.Sequence(datasets.Value("string")),
|
| 77 |
+
"candidates": datasets.features.Sequence(datasets.Value("string")),
|
| 78 |
+
"answer": datasets.Value("string"),
|
| 79 |
+
"id": datasets.Value("string")
|
| 80 |
+
# These are the features of your dataset like images, labels ...
|
| 81 |
+
}
|
| 82 |
+
),
|
| 83 |
+
# If there's a common (input, target) tuple from the features,
|
| 84 |
+
# specify them here. They'll be used if as_supervised=True in
|
| 85 |
+
# builder.as_dataset.
|
| 86 |
+
supervised_keys=None,
|
| 87 |
+
# Homepage of the dataset for documentation
|
| 88 |
+
homepage="http://qangaroo.cs.ucl.ac.uk/index.html",
|
| 89 |
+
citation=_CITATION,
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
def _split_generators(self, dl_manager):
|
| 93 |
+
"""Returns SplitGenerators."""
|
| 94 |
+
# TODO(qangaroo): Downloads the data and defines the splits
|
| 95 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to
|
| 96 |
+
# download and extract URLs
|
| 97 |
+
dl_dir = dl_manager.download_and_extract(_URL)
|
| 98 |
+
data_dir = os.path.join(dl_dir, "qangaroo_v1.1")
|
| 99 |
+
train_file = "train.masked.json" if "masked" in self.config.name else "train.json"
|
| 100 |
+
dev_file = "dev.masked.json" if "masked" in self.config.name else "dev.json"
|
| 101 |
+
return [
|
| 102 |
+
datasets.SplitGenerator(
|
| 103 |
+
name=datasets.Split.TRAIN,
|
| 104 |
+
# These kwargs will be passed to _generate_examples
|
| 105 |
+
gen_kwargs={"filepath": os.path.join(data_dir, self.config.data_dir, train_file)},
|
| 106 |
+
),
|
| 107 |
+
datasets.SplitGenerator(
|
| 108 |
+
name=datasets.Split.VALIDATION,
|
| 109 |
+
# These kwargs will be passed to _generate_examples
|
| 110 |
+
gen_kwargs={"filepath": os.path.join(data_dir, self.config.data_dir, dev_file)},
|
| 111 |
+
),
|
| 112 |
+
]
|
| 113 |
+
|
| 114 |
+
def _generate_examples(self, filepath):
|
| 115 |
+
"""Yields examples."""
|
| 116 |
+
# TODO(quangaroo): Yields (key, example) tuples from the dataset
|
| 117 |
+
with open(filepath, encoding="utf-8") as f:
|
| 118 |
+
data = json.load(f)
|
| 119 |
+
for example in data:
|
| 120 |
+
id_ = example["id"]
|
| 121 |
+
yield id_, {
|
| 122 |
+
"id": example["id"],
|
| 123 |
+
"query": example["query"],
|
| 124 |
+
"supports": example["supports"],
|
| 125 |
+
"candidates": example["candidates"],
|
| 126 |
+
"answer": example["answer"],
|
| 127 |
+
}
|