Commit ·
88d89a0
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
Files changed (4)
- .gitattributesAdded+27
- dataset_infos.jsonAdded+1
- dummy/plain_text/1.0.0/dummy_data.zipAdded+3
- xnli.pyAdded+120
123456789101112131415161718192021222324252627*.7z filter=lfs diff=lfs merge=lfs -text*.arrow filter=lfs diff=lfs merge=lfs -text*.bin filter=lfs diff=lfs merge=lfs -text*.bin.* filter=lfs diff=lfs merge=lfs -text*.bz2 filter=lfs diff=lfs merge=lfs -text*.ftz filter=lfs diff=lfs merge=lfs -text*.gz filter=lfs diff=lfs merge=lfs -text*.h5 filter=lfs diff=lfs merge=lfs -text*.joblib filter=lfs diff=lfs merge=lfs -text*.lfs.* filter=lfs diff=lfs merge=lfs -text*.model filter=lfs diff=lfs merge=lfs -text*.msgpack filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.ot filter=lfs diff=lfs merge=lfs -text*.parquet filter=lfs diff=lfs merge=lfs -text*.pb filter=lfs diff=lfs merge=lfs -text*.pt filter=lfs diff=lfs merge=lfs -text*.pth filter=lfs diff=lfs merge=lfs -text*.rar filter=lfs diff=lfs merge=lfs -textsaved_model/**/* filter=lfs diff=lfs merge=lfs -text*.tar.* filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.tgz filter=lfs diff=lfs merge=lfs -text*.xz filter=lfs diff=lfs merge=lfs -text*.zip filter=lfs diff=lfs merge=lfs -text*.zstandard filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text1{"plain_text": {"description": "XNLI is a subset of a few thousand examples from MNLI which has been translated\ninto a 14 different languages (some low-ish resource). As with MNLI, the goal is\nto predict textual entailment (does sentence A imply/contradict/neither sentence\nB) and is a classification task (given two sentences, predict one of three\nlabels).\n", "citation": "@InProceedings{conneau2018xnli,\n author = \"Conneau, Alexis\n and Rinott, Ruty\n and Lample, Guillaume\n and Williams, Adina\n and Bowman, Samuel R.\n and Schwenk, Holger\n and Stoyanov, Veselin\",\n title = \"XNLI: Evaluating Cross-lingual Sentence Representations\",\n booktitle = \"Proceedings of the 2018 Conference on Empirical Methods\n in Natural Language Processing\",\n year = \"2018\",\n publisher = \"Association for Computational Linguistics\",\n location = \"Brussels, Belgium\",\n}", "homepage": "https://www.nyu.edu/projects/bowman/xnli/", "license": "", "features": {"premise": {"languages": ["ar", "bg", "de", "el", "en", "es", "fr", "hi", "ru", "sw", "th", "tr", "ur", "vi", "zh"], "id": null, "_type": "Translation"}, "hypothesis": {"languages": ["ar", "bg", "de", "el", "en", "es", "fr", "hi", "ru", "sw", "th", "tr", "ur", "vi", "zh"], "num_languages": 15, "id": null, "_type": "TranslationVariableLanguages"}, "label": {"num_classes": 3, "names": ["entailment", "neutral", "contradiction"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "supervised_keys": null, "builder_name": "xnli", "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": 19419463, "num_examples": 5010, "dataset_name": "xnli"}, "validation": {"name": "validation", "num_bytes": 9582145, "num_examples": 2490, "dataset_name": "xnli"}}, "download_checksums": {"https://www.nyu.edu/projects/bowman/xnli/XNLI-1.0.zip": {"num_bytes": 17865352, "checksum": "4ba1d5e1afdb7161f0f23c66dc787802ccfa8a25a3ddd3b165a35e50df346ab1"}}, "download_size": 17865352, "dataset_size": 29001608, "size_in_bytes": 46866960}}123version https://git-lfs.github.com/spec/v1oid sha256:087e5fb69a4751ad440cfac64e14928dd0ada6afe3d1ec2caaaaf2128b00da6bsize 6032123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120# coding=utf-8# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.
# Lint as: python3"""XNLI: The Cross-Lingual NLI Corpus."""
from __future__ import absolute_import, division, print_function
import collectionsimport csvimport os
import six
import datasets
_CITATION = """\@InProceedings{conneau2018xnli, author = {Conneau, Alexis and Rinott, Ruty and Lample, Guillaume and Williams, Adina and Bowman, Samuel R. and Schwenk, Holger and Stoyanov, Veselin}, title = {XNLI: Evaluating Cross-lingual Sentence Representations}, booktitle = {Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing}, year = {2018}, publisher = {Association for Computational Linguistics}, location = {Brussels, Belgium},}"""
_DESCRIPTION = """\XNLI is a subset of a few thousand examples from MNLI which has been translatedinto a 14 different languages (some low-ish resource). As with MNLI, the goal isto predict textual entailment (does sentence A imply/contradict/neither sentenceB) and is a classification task (given two sentences, predict one of threelabels)."""
_DATA_URL = "https://www.nyu.edu/projects/bowman/xnli/XNLI-1.0.zip"
_LANGUAGES = ("ar", "bg", "de", "el", "en", "es", "fr", "hi", "ru", "sw", "th", "tr", "ur", "vi", "zh")
class Xnli(datasets.GeneratorBasedBuilder): """XNLI: The Cross-Lingual NLI Corpus. Version 1.0."""
BUILDER_CONFIGS = [ datasets.BuilderConfig( name="plain_text", version=datasets.Version("1.0.0", ""), description="Plain text import of XNLI", ) ]
def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "premise": datasets.features.Translation( languages=_LANGUAGES, ), "hypothesis": datasets.features.TranslationVariableLanguages( languages=_LANGUAGES, ), "label": datasets.features.ClassLabel(names=["entailment", "neutral", "contradiction"]), } ), # No default supervised_keys (as we have to pass both premise # and hypothesis as input). supervised_keys=None, homepage="https://www.nyu.edu/projects/bowman/xnli/", citation=_CITATION, )
def _split_generators(self, dl_manager): dl_dir = dl_manager.download_and_extract(_DATA_URL) data_dir = os.path.join(dl_dir, "XNLI-1.0") return [ datasets.SplitGenerator( name=datasets.Split.TEST, gen_kwargs={"filepath": os.path.join(data_dir, "xnli.test.tsv")} ), datasets.SplitGenerator( name=datasets.Split.VALIDATION, gen_kwargs={"filepath": os.path.join(data_dir, "xnli.dev.tsv")} ), ]
def _generate_examples(self, filepath): """This function returns the examples in the raw (text) form.""" rows_per_pair_id = collections.defaultdict(list)
with open(filepath, encoding="utf-8") as f: reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE) for row in reader: rows_per_pair_id[row["pairID"]].append(row)
for rows in six.itervalues(rows_per_pair_id): premise = {row["language"]: row["sentence1"] for row in rows} hypothesis = {row["language"]: row["sentence2"] for row in rows} yield rows[0]["pairID"], { "premise": premise, "hypothesis": hypothesis, "label": rows[0]["gold_label"], }.gitattributesAdded+27
dataset_infos.jsonAdded+1
dummy/plain_text/1.0.0/dummy_data.zipAdded+3
xnli.pyAdded+120