





"""simple docstring"""





import datasets


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

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

SCREAMING_SNAKE_CASE__   =  "\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	:		Dict				,		SCREAMING_SNAKE_CASE	:		List[Any]     ):







      '''simple docstring'''




      return (preds == labels).mean()






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





      def        _snake_case     (			self					)						->	Optional[int]:
            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					)						->	int:
            return {"accuracy": simple_accuracy(lowercase ,		lowercase					)}













"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


SCREAMING_SNAKE_CASE__   =  {
    "configuration_roformer": ["ROFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "RoFormerConfig", "RoFormerOnnxConfig"],
    "tokenization_roformer": ["RoFormerTokenizer"],
}

try:
       if not is_tokenizers_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       SCREAMING_SNAKE_CASE__   =  ["RoFormerTokenizerFast"]

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       SCREAMING_SNAKE_CASE__   =  [
           "ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
           "RoFormerForCausalLM",
           "RoFormerForMaskedLM",
           "RoFormerForMultipleChoice",
           "RoFormerForQuestionAnswering",
           "RoFormerForSequenceClassification",
           "RoFormerForTokenClassification",
           "RoFormerLayer",
           "RoFormerModel",
           "RoFormerPreTrainedModel",
           "load_tf_weights_in_roformer",
       ]


try:
       if not is_tf_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       SCREAMING_SNAKE_CASE__   =  [
           "TF_ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
           "TFRoFormerForCausalLM",
           "TFRoFormerForMaskedLM",
           "TFRoFormerForMultipleChoice",
           "TFRoFormerForQuestionAnswering",
           "TFRoFormerForSequenceClassification",
           "TFRoFormerForTokenClassification",
           "TFRoFormerLayer",
           "TFRoFormerModel",
           "TFRoFormerPreTrainedModel",
       ]


try:
       if not is_flax_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       SCREAMING_SNAKE_CASE__   =  [
           "FLAX_ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
           "FlaxRoFormerForMaskedLM",
           "FlaxRoFormerForMultipleChoice",
           "FlaxRoFormerForQuestionAnswering",
           "FlaxRoFormerForSequenceClassification",
           "FlaxRoFormerForTokenClassification",
           "FlaxRoFormerModel",
           "FlaxRoFormerPreTrainedModel",
       ]


if TYPE_CHECKING:
       from .configuration_roformer import ROFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, RoFormerConfig, RoFormerOnnxConfig
       from .tokenization_roformer import RoFormerTokenizer

       try:
              if not is_tokenizers_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .tokenization_roformer_fast import RoFormerTokenizerFast

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_roformer import (
                  ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
                  RoFormerForCausalLM,
                  RoFormerForMaskedLM,
                  RoFormerForMultipleChoice,
                  RoFormerForQuestionAnswering,
                  RoFormerForSequenceClassification,
                  RoFormerForTokenClassification,
                  RoFormerLayer,
                  RoFormerModel,
                  RoFormerPreTrainedModel,
                  load_tf_weights_in_roformer,
              )

       try:
              if not is_tf_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tf_roformer import (
                  TF_ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
                  TFRoFormerForCausalLM,
                  TFRoFormerForMaskedLM,
                  TFRoFormerForMultipleChoice,
                  TFRoFormerForQuestionAnswering,
                  TFRoFormerForSequenceClassification,
                  TFRoFormerForTokenClassification,
                  TFRoFormerLayer,
                  TFRoFormerModel,
                  TFRoFormerPreTrainedModel,
              )

       try:
              if not is_flax_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_flax_roformer import (
                  FLAX_ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
                  FlaxRoFormerForMaskedLM,
                  FlaxRoFormerForMultipleChoice,
                  FlaxRoFormerForQuestionAnswering,
                  FlaxRoFormerForSequenceClassification,
                  FlaxRoFormerForTokenClassification,
                  FlaxRoFormerModel,
                  FlaxRoFormerPreTrainedModel,
              )


else:
       import sys

       SCREAMING_SNAKE_CASE__   =  _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)






