


"""simple docstring"""







from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


__lowercase    =				logging.get_logger(__name__)

__lowercase    =				{
    """facebook/deit-base-distilled-patch16-224""": (
        """https://huggingface.co/facebook/deit-base-patch16-224/resolve/main/config.json"""
    ),
    # See all DeiT models at https://huggingface.co/models?filter=deit
}






class 						_A  (  _a  ):







    """simple docstring"""




    UpperCAmelCase	:							int     =	"""deit"""






    def __init__( self    :   Any    ,			__UpperCAmelCase    :   Tuple=768    ,			__UpperCAmelCase    :   str=12    ,			__UpperCAmelCase    :   Any=12    ,			__UpperCAmelCase    :   int=3072    ,			__UpperCAmelCase    :   Union[str, Any]="gelu"    ,			__UpperCAmelCase    :   Tuple=0.0    ,			__UpperCAmelCase    :   Tuple=0.0    ,			__UpperCAmelCase    :   Any=0.02    ,			__UpperCAmelCase    :   Any=1e-12    ,			__UpperCAmelCase    :   str=224    ,			__UpperCAmelCase    :   Any=16    ,			__UpperCAmelCase    :   Tuple=3    ,			__UpperCAmelCase    :   Optional[Any]=True    ,			__UpperCAmelCase    :   List[Any]=16    ,			**__UpperCAmelCase    :   Any    ,			):
      super().__init__(**__UpperCAmelCase)

      a						:		Optional[Any]											=      hidden_size
      a						:		List[Any]											=      num_hidden_layers
      a						:		List[Any]											=      num_attention_heads
      a						:		Optional[Any]											=      intermediate_size
      a						:		Union[str, Any]											=      hidden_act
      a						:		Tuple											=      hidden_dropout_prob
      a						:		List[Any]											=      attention_probs_dropout_prob
      a						:		Optional[int]											=      initializer_range
      a						:		Tuple											=      layer_norm_eps
      a						:		int											=      image_size
      a						:		List[Any]											=      patch_size
      a						:		str											=      num_channels
      a						:		Dict											=      qkv_bias
      a						:		int											=      encoder_stride






class 						_A  (  _a  ):







    """simple docstring"""




    UpperCAmelCase	:							Optional[int]     =	version.parse("""1.11"""  )






    @property
    def      __snake_case							( self    :   Dict):
      return OrderedDict(
          [
              ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
          ])






    @property
    def      __snake_case							( self    :   Dict):
      return 1e-4










"""simple docstring"""







import datasets


__lowercase    =				"""\
@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\",
}
"""

__lowercase    =				"""\
XNLI is a subset of a few thousand examples from MNLI which has been translated
into a 14 different languages (some low-ish resource). As with MNLI, the goal is
to predict textual entailment (does sentence A imply/contradict/neither sentence
B) and is a classification task (given two sentences, predict one of three
labels).
"""

__lowercase    =				"""
Computes XNLI score which is just simple accuracy.
Args:
    predictions: Predicted labels.
    references: Ground truth labels.
Returns:
    'accuracy': accuracy
Examples:

    >>> predictions = [0, 1]
    >>> references = [0, 1]
    >>> xnli_metric = datasets.load_metric(\"xnli\")
    >>> results = xnli_metric.compute(predictions=predictions, references=references)
    >>> print(results)
    {'accuracy': 1.0}
"""


def 					lowercase      (    A_  ,       A_	)->				List[str]:
  '''simple docstring'''







  return (preds == labels).mean()







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







    """simple docstring"""




    def      __snake_case							( self    :   List[str]):
      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    :   str    ,			__UpperCAmelCase    :   List[Any]    ,			__UpperCAmelCase    :   Tuple):
      return {"accuracy": simple_accuracy(__UpperCAmelCase    ,			__UpperCAmelCase)}






