Commit
·
3b913b7
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/1.0.0/dummy_data.zip +3 -0
- snli.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 |
+
{"plain_text": {"description": "The SNLI corpus (version 1.0) is a collection of 570k human-written English\nsentence pairs manually labeled for balanced classification with the labels\nentailment, contradiction, and neutral, supporting the task of natural language\ninference (NLI), also known as recognizing textual entailment (RTE).\n", "citation": "@inproceedings{snli:emnlp2015,\n\tAuthor = {Bowman, Samuel R. and Angeli, Gabor and Potts, Christopher, and Manning, Christopher D.},\n\tBooktitle = {Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (EMNLP)},\n\tPublisher = {Association for Computational Linguistics},\n\tTitle = {A large annotated corpus for learning natural language inference},\n\tYear = {2015}\n}\n", "homepage": "https://nlp.stanford.edu/projects/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"}}, "supervised_keys": null, "builder_name": "snli", "config_name": "plain_text", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 1263912, "num_examples": 10000, "dataset_name": "snli"}, "train": {"name": "train", "num_bytes": 66159510, "num_examples": 550152, "dataset_name": "snli"}, "validation": {"name": "validation", "num_bytes": 1268044, "num_examples": 10000, "dataset_name": "snli"}}, "download_checksums": {"https://nlp.stanford.edu/projects/snli/snli_1.0.zip": {"num_bytes": 94550081, "checksum": "afb3d70a5af5d8de0d9d81e2637e0fb8c22d1235c2749d83125ca43dab0dbd3e"}}, "download_size": 94550081, "dataset_size": 68691466, "size_in_bytes": 163241547}}
|
dummy/plain_text/1.0.0/dummy_data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:415936f595d8ec7c004a08095d90c41b29ffcb769d032de336e67475c0a4d744
|
| 3 |
+
size 2282
|
snli.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"""The Stanford Natural Language Inference (SNLI) Corpus."""
|
| 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 |
+
@inproceedings{snli:emnlp2015,
|
| 29 |
+
Author = {Bowman, Samuel R. and Angeli, Gabor and Potts, Christopher, and Manning, Christopher D.},
|
| 30 |
+
Booktitle = {Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
|
| 31 |
+
Publisher = {Association for Computational Linguistics},
|
| 32 |
+
Title = {A large annotated corpus for learning natural language inference},
|
| 33 |
+
Year = {2015}
|
| 34 |
+
}
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
_DESCRIPTION = """\
|
| 38 |
+
The SNLI corpus (version 1.0) is a collection of 570k human-written English
|
| 39 |
+
sentence pairs manually labeled for balanced classification with the labels
|
| 40 |
+
entailment, contradiction, and neutral, supporting the task of natural language
|
| 41 |
+
inference (NLI), also known as recognizing textual entailment (RTE).
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
_DATA_URL = "https://nlp.stanford.edu/projects/snli/snli_1.0.zip"
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class Snli(datasets.GeneratorBasedBuilder):
|
| 48 |
+
"""The Stanford Natural Language Inference (SNLI) Corpus."""
|
| 49 |
+
|
| 50 |
+
BUILDER_CONFIGS = [
|
| 51 |
+
datasets.BuilderConfig(
|
| 52 |
+
name="plain_text",
|
| 53 |
+
version=datasets.Version("1.0.0", ""),
|
| 54 |
+
description="Plain text import of SNLI",
|
| 55 |
+
)
|
| 56 |
+
]
|
| 57 |
+
|
| 58 |
+
def _info(self):
|
| 59 |
+
return datasets.DatasetInfo(
|
| 60 |
+
description=_DESCRIPTION,
|
| 61 |
+
features=datasets.Features(
|
| 62 |
+
{
|
| 63 |
+
"premise": datasets.Value("string"),
|
| 64 |
+
"hypothesis": datasets.Value("string"),
|
| 65 |
+
"label": datasets.features.ClassLabel(names=["entailment", "neutral", "contradiction"]),
|
| 66 |
+
}
|
| 67 |
+
),
|
| 68 |
+
# No default supervised_keys (as we have to pass both premise
|
| 69 |
+
# and hypothesis as input).
|
| 70 |
+
supervised_keys=None,
|
| 71 |
+
homepage="https://nlp.stanford.edu/projects/snli/",
|
| 72 |
+
citation=_CITATION,
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
def _split_generators(self, dl_manager):
|
| 76 |
+
dl_dir = dl_manager.download_and_extract(_DATA_URL)
|
| 77 |
+
data_dir = os.path.join(dl_dir, "snli_1.0")
|
| 78 |
+
return [
|
| 79 |
+
datasets.SplitGenerator(
|
| 80 |
+
name=datasets.Split.TEST, gen_kwargs={"filepath": os.path.join(data_dir, "snli_1.0_test.txt")}
|
| 81 |
+
),
|
| 82 |
+
datasets.SplitGenerator(
|
| 83 |
+
name=datasets.Split.VALIDATION, gen_kwargs={"filepath": os.path.join(data_dir, "snli_1.0_dev.txt")}
|
| 84 |
+
),
|
| 85 |
+
datasets.SplitGenerator(
|
| 86 |
+
name=datasets.Split.TRAIN, gen_kwargs={"filepath": os.path.join(data_dir, "snli_1.0_train.txt")}
|
| 87 |
+
),
|
| 88 |
+
]
|
| 89 |
+
|
| 90 |
+
def _generate_examples(self, filepath):
|
| 91 |
+
"""This function returns the examples in the raw (text) form."""
|
| 92 |
+
with open(filepath, encoding="utf-8") as f:
|
| 93 |
+
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
| 94 |
+
for idx, row in enumerate(reader):
|
| 95 |
+
label = -1 if row["gold_label"] == "-" else row["gold_label"]
|
| 96 |
+
yield idx, {
|
| 97 |
+
"premise": row["sentence1"],
|
| 98 |
+
"hypothesis": row["sentence2"],
|
| 99 |
+
"label": label,
|
| 100 |
+
}
|