
'''simple docstring'''
import datasets


a_											=						"\\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"

a_											=						"\\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"

a_											=						"\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_     (	__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE       ):
    """simple docstring"""






    return (preds == labels).mean()






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





 def        snake_case__		(    self):
     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 ,       lowercase_ ,       lowercase_):
     return {"accuracy": simple_accuracy(lowercase_ ,       lowercase_)}






'''simple docstring'''
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding






class    UpperCAmelCase_				(	snake_case__					):
 UpperCAmelCase_		    =						"""ClapFeatureExtractor"""
 UpperCAmelCase_		    =						("""RobertaTokenizer""", """RobertaTokenizerFast""")





 def __init__(    self ,       lowercase_ ,       lowercase_):
     super().__init__(lowercase_ ,       lowercase_)





 def __call__(    self ,       lowercase_=None ,       lowercase_=None ,       lowercase_=None ,       **lowercase_):
     snake_case_ :    Any     			=						kwargs.pop("sampling_rate" ,       lowercase_)

     if text is None and audios is None:
         raise ValueError("You have to specify either text or audios. Both cannot be none.")

     if text is not None:
         snake_case_ :    Optional[int]     			=						self.tokenizer(lowercase_ ,       return_tensors=lowercase_ ,       **lowercase_)

     if audios is not None:
         snake_case_ :    Any     			=						self.feature_extractor(
             lowercase_ ,       sampling_rate=lowercase_ ,       return_tensors=lowercase_ ,       **lowercase_)

     if text is not None and audios is not None:
         snake_case_ :    Dict     			=						audio_features.input_features
         return encoding
     elif text is not None:
         return encoding
     else:
         return BatchEncoding(data=dict(**lowercase_) ,       tensor_type=lowercase_)





 def        snake_case__		(    self ,       *lowercase_ ,       **lowercase_):
     return self.tokenizer.batch_decode(*lowercase_ ,       **lowercase_)





 def        snake_case__		(    self ,       *lowercase_ ,       **lowercase_):
     return self.tokenizer.decode(*lowercase_ ,       **lowercase_)





 @property
 def        snake_case__		(    self):
     snake_case_ :    Union[str, Any]     			=						self.tokenizer.model_input_names
     snake_case_ :    int     			=						self.feature_extractor.model_input_names
     return list(dict.fromkeys(tokenizer_input_names + feature_extractor_input_names))




