Commit
•
bfe81a4
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/plain_text/0.0.2/dummy_data.zip +3 -0
- esnli.py +120 -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 |
+
{"plain_text": {"description": "\nThe e-SNLI dataset extends the Stanford Natural Language Inference Dataset to\ninclude human-annotated natural language explanations of the entailment\nrelations.\n", "citation": "\n@incollection{NIPS2018_8163,\ntitle = {e-SNLI: Natural Language Inference with Natural Language Explanations},\nauthor = {Camburu, Oana-Maria and Rockt\"{a}schel, Tim and Lukasiewicz, Thomas and Blunsom, Phil},\nbooktitle = {Advances in Neural Information Processing Systems 31},\neditor = {S. Bengio and H. Wallach and H. Larochelle and K. Grauman and N. Cesa-Bianchi and R. Garnett},\npages = {9539--9549},\nyear = {2018},\npublisher = {Curran Associates, Inc.},\nurl = {http://papers.nips.cc/paper/8163-e-snli-natural-language-inference-with-natural-language-explanations.pdf}\n}\n", "homepage": "https://github.com/OanaMariaCamburu/e-SNLI", "license": "", "features": {"premise": {"dtype": "string", "id": null, "_type": "Value"}, "hypothesis": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["entailment", "neutral", "contradiction"], "names_file": null, "id": null, "_type": "ClassLabel"}, "explanation_1": {"dtype": "string", "id": null, "_type": "Value"}, "explanation_2": {"dtype": "string", "id": null, "_type": "Value"}, "explanation_3": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "esnli", "config_name": "plain_text", "version": {"version_str": "0.0.2", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 0, "patch": 2}, "splits": {"test": {"name": "test", "num_bytes": 3387169, "num_examples": 9824, "dataset_name": "esnli"}, "train": {"name": "train", "num_bytes": 108024142, "num_examples": 549367, "dataset_name": "esnli"}, "validation": {"name": "validation", "num_bytes": 3423725, "num_examples": 9842, "dataset_name": "esnli"}}, "download_checksums": {"https://raw.githubusercontent.com/OanaMariaCamburu/e-SNLI/master/dataset/esnli_train_1.csv": {"num_bytes": 90169741, "checksum": "7311c7bc16ad9f6a9adcd116a62ef991e1803dc0d71e253ce66b975c2aba8ee5"}, "https://raw.githubusercontent.com/OanaMariaCamburu/e-SNLI/master/dataset/esnli_train_2.csv": {"num_bytes": 99406852, "checksum": "c8827fa2ba1ef5891f077d6fafbfc2fdb6cab1271968b74257e08d3b2b3cbacc"}, "https://raw.githubusercontent.com/OanaMariaCamburu/e-SNLI/master/dataset/esnli_dev.csv": {"num_bytes": 7501310, "checksum": "d7a656d196eea18fd827d6f5486b00f5d4cf469dbf13a252cc211495a186bcb4"}, "https://raw.githubusercontent.com/OanaMariaCamburu/e-SNLI/master/dataset/esnli_test.csv": {"num_bytes": 7438107, "checksum": "9269aa8075dbfed0fa8a5012eb2ac9c18a92be139671f05df897f69092592927"}}, "download_size": 204516010, "dataset_size": 114835036, "size_in_bytes": 319351046}}
|
dummy/plain_text/0.0.2/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8f2793fa82778bff2c43589454471aa0e7e07c16c5223461490c652db59c7bc0
|
3 |
+
size 1643
|
esnli.py
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""e-SNLI: Natural Language Inference with Natural Language Explanations."""
|
18 |
+
|
19 |
+
from __future__ import absolute_import, division, print_function
|
20 |
+
|
21 |
+
import csv
|
22 |
+
import os
|
23 |
+
|
24 |
+
import datasets
|
25 |
+
|
26 |
+
|
27 |
+
_CITATION = """
|
28 |
+
@incollection{NIPS2018_8163,
|
29 |
+
title = {e-SNLI: Natural Language Inference with Natural Language Explanations},
|
30 |
+
author = {Camburu, Oana-Maria and Rockt\"{a}schel, Tim and Lukasiewicz, Thomas and Blunsom, Phil},
|
31 |
+
booktitle = {Advances in Neural Information Processing Systems 31},
|
32 |
+
editor = {S. Bengio and H. Wallach and H. Larochelle and K. Grauman and N. Cesa-Bianchi and R. Garnett},
|
33 |
+
pages = {9539--9549},
|
34 |
+
year = {2018},
|
35 |
+
publisher = {Curran Associates, Inc.},
|
36 |
+
url = {http://papers.nips.cc/paper/8163-e-snli-natural-language-inference-with-natural-language-explanations.pdf}
|
37 |
+
}
|
38 |
+
"""
|
39 |
+
|
40 |
+
_DESCRIPTION = """
|
41 |
+
The e-SNLI dataset extends the Stanford Natural Language Inference Dataset to
|
42 |
+
include human-annotated natural language explanations of the entailment
|
43 |
+
relations.
|
44 |
+
"""
|
45 |
+
_URL = "https://raw.githubusercontent.com/OanaMariaCamburu/e-SNLI/master/dataset/"
|
46 |
+
|
47 |
+
|
48 |
+
class Esnli(datasets.GeneratorBasedBuilder):
|
49 |
+
"""e-SNLI: Natural Language Inference with Natural Language Explanations corpus."""
|
50 |
+
|
51 |
+
# Version History
|
52 |
+
# 0.0.2 Added explanation_2, explanation_3 fields which exist in the dev/test
|
53 |
+
# splits only.
|
54 |
+
# 0.0.1 Initial version
|
55 |
+
BUILDER_CONFIGS = [
|
56 |
+
datasets.BuilderConfig(
|
57 |
+
name="plain_text",
|
58 |
+
version=datasets.Version("0.0.2"),
|
59 |
+
description="Plain text import of e-SNLI",
|
60 |
+
)
|
61 |
+
]
|
62 |
+
|
63 |
+
def _info(self):
|
64 |
+
return datasets.DatasetInfo(
|
65 |
+
description=_DESCRIPTION,
|
66 |
+
features=datasets.Features(
|
67 |
+
{
|
68 |
+
"premise": datasets.Value("string"),
|
69 |
+
"hypothesis": datasets.Value("string"),
|
70 |
+
"label": datasets.features.ClassLabel(names=["entailment", "neutral", "contradiction"]),
|
71 |
+
"explanation_1": datasets.Value("string"),
|
72 |
+
"explanation_2": datasets.Value("string"),
|
73 |
+
"explanation_3": datasets.Value("string"),
|
74 |
+
}
|
75 |
+
),
|
76 |
+
supervised_keys=None,
|
77 |
+
homepage="https://github.com/OanaMariaCamburu/e-SNLI",
|
78 |
+
citation=_CITATION,
|
79 |
+
)
|
80 |
+
|
81 |
+
def _split_generators(self, dl_manager):
|
82 |
+
"""Returns SplitGenerators."""
|
83 |
+
|
84 |
+
files = dl_manager.download_and_extract(
|
85 |
+
{
|
86 |
+
"train": [os.path.join(_URL, "esnli_train_1.csv"), os.path.join(_URL, "esnli_train_2.csv")],
|
87 |
+
"validation": [os.path.join(_URL, "esnli_dev.csv")],
|
88 |
+
"test": [os.path.join(_URL, "esnli_test.csv")],
|
89 |
+
}
|
90 |
+
)
|
91 |
+
|
92 |
+
return [
|
93 |
+
datasets.SplitGenerator(
|
94 |
+
name=datasets.Split.TRAIN,
|
95 |
+
gen_kwargs={"files": files["train"]},
|
96 |
+
),
|
97 |
+
datasets.SplitGenerator(
|
98 |
+
name=datasets.Split.VALIDATION,
|
99 |
+
gen_kwargs={"files": files["validation"]},
|
100 |
+
),
|
101 |
+
datasets.SplitGenerator(
|
102 |
+
name=datasets.Split.TEST,
|
103 |
+
gen_kwargs={"files": files["test"]},
|
104 |
+
),
|
105 |
+
]
|
106 |
+
|
107 |
+
def _generate_examples(self, files):
|
108 |
+
"""Yields examples."""
|
109 |
+
for filepath in files:
|
110 |
+
with open(filepath, encoding="utf-8") as f:
|
111 |
+
reader = csv.DictReader(f)
|
112 |
+
for _, row in enumerate(reader):
|
113 |
+
yield row["pairID"], {
|
114 |
+
"premise": row["Sentence1"],
|
115 |
+
"hypothesis": row["Sentence2"],
|
116 |
+
"label": row["gold_label"],
|
117 |
+
"explanation_1": row["Explanation_1"],
|
118 |
+
"explanation_2": row.get("Explanation_2", ""),
|
119 |
+
"explanation_3": row.get("Explanation_3", ""),
|
120 |
+
}
|