


import datasets


__UpperCamelCase     		=							'\\n@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}\n'

__UpperCamelCase     		=							'\\nXNLI 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'

__UpperCamelCase     		=							'\nComputes XNLI score which is just simple accuracy.\nArgs:\n    predictions: Predicted labels.\n    references: Ground truth labels.\nReturns:\n    \'accuracy\': accuracy\nExamples:\n\n    >>> predictions = [0, 1]\n    >>> references = [0, 1]\n    >>> xnli_metric = datasets.load_metric("xnli")\n    >>> results = xnli_metric.compute(predictions=predictions, references=references)\n    >>> print(results)\n    {\'accuracy\': 1.0}\n'
def 							UpperCamelCase_(					_A :int					,  _A :int	)->		Dict:
			return (preds == labels).mean()







@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION       ,						_KWARGS_DESCRIPTION   )
class 							lowerCamelCase__						(				datasets.Metric   ):






			"""simple docstring"""






			def 					snake_case__					(				self  ):

						'''simple docstring'''


						return datasets.MetricInfo(
						    description=_DESCRIPTION   ,    citation=_CITATION   ,    inputs_description=_KWARGS_DESCRIPTION   ,    features=datasets.Features(
						        {
						            "predictions": datasets.Value("int64" if self.config_name != "sts-b" else "float32"  ),
						            "references": datasets.Value("int64" if self.config_name != "sts-b" else "float32"  ),
						        }  )   ,    codebase_urls=[]   ,    reference_urls=[]   ,    format="numpy"   ,    )







			def 					snake_case__					(				self   ,    snake_case   ,    snake_case  ):

						'''simple docstring'''


						return {"accuracy": simple_accuracy(snake_case   ,    snake_case  )}






from typing import Callable, Optional

from .. import Features
from ..packaged_modules.generator.generator import Generator
from .abc import AbstractDatasetInputStream







class 							lowerCamelCase__						(				UpperCAmelCase   ):






			"""simple docstring"""






			def __init__(				self   ,    snake_case   ,    snake_case = None   ,    snake_case = None   ,    snake_case = False   ,    snake_case = False   ,    snake_case = None   ,    snake_case = None   ,    **snake_case   ,    ):

						'''simple docstring'''


						super().__init__(
						    features=snake_case   ,    cache_dir=snake_case   ,    keep_in_memory=snake_case   ,    streaming=snake_case   ,    num_proc=snake_case   ,    **snake_case   ,    )
						UpperCamelCase__       =							Generator(
						    cache_dir=snake_case   ,    features=snake_case   ,    generator=snake_case   ,    gen_kwargs=snake_case   ,    **snake_case   ,    )







			def 					snake_case__					(				self  ):

						'''simple docstring'''


						if self.streaming:
									UpperCamelCase__       =							self.builder.as_streaming_dataset(split="train"  )
						# Build regular (map-style) dataset
						else:
									UpperCamelCase__       =							None
									UpperCamelCase__       =							None
									UpperCamelCase__       =							None
									UpperCamelCase__       =							None

									self.builder.download_and_prepare(
									    download_config=snake_case   ,    download_mode=snake_case   ,    verification_mode=snake_case   ,    base_path=snake_case   ,    num_proc=self.num_proc   ,    )
									UpperCamelCase__       =							self.builder.as_dataset(
									    split="train"   ,    verification_mode=snake_case   ,    in_memory=self.keep_in_memory  )
						return dataset


