
"""simple docstring"""





from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


_a														=		logging.get_logger(__name__)

_a														=		{
    """shi-labs/nat-mini-in1k-224""": """https://huggingface.co/shi-labs/nat-mini-in1k-224/resolve/main/config.json""",
    # See all Nat models at https://huggingface.co/models?filter=nat
}






class     _UpperCAmelCase(    lowerCamelCase      ,     lowerCamelCase	):
		lowercase__						=      'nat'

		lowercase__						=      {
		    'num_attention_heads': 'num_heads',
		    'num_hidden_layers': 'num_layers',
		}



		def __init__(					self				,		__a=4				,		__a=3				,		__a=64				,		__a=[3, 4, 6, 5]				,		__a=[2, 4, 8, 16]				,		__a=7				,		__a=3.0				,		__a=True				,		__a=0.0				,		__a=0.0				,		__a=0.1				,		__a="gelu"				,		__a=0.02				,		__a=1e-5				,		__a=0.0				,		__a=None				,		__a=None				,		**__a				,		)       ->       Tuple:






							'''simple docstring'''
							super().__init__(**__a)

							_UpperCamelCase							 =  patch_size
							_UpperCamelCase							 =  num_channels
							_UpperCamelCase							 =  embed_dim
							_UpperCamelCase							 =  depths
							_UpperCamelCase							 =  len(__a)
							_UpperCamelCase							 =  num_heads
							_UpperCamelCase							 =  kernel_size
							_UpperCamelCase							 =  mlp_ratio
							_UpperCamelCase							 =  qkv_bias
							_UpperCamelCase							 =  hidden_dropout_prob
							_UpperCamelCase							 =  attention_probs_dropout_prob
							_UpperCamelCase							 =  drop_path_rate
							_UpperCamelCase							 =  hidden_act
							_UpperCamelCase							 =  layer_norm_eps
							_UpperCamelCase							 =  initializer_range
							# we set the hidden_size attribute in order to make Nat work with VisionEncoderDecoderModel
							# this indicates the channel dimension after the last stage of the model
							_UpperCamelCase							 =  int(embed_dim * 2 ** (len(__a) - 1))
							_UpperCamelCase							 =  layer_scale_init_value
							_UpperCamelCase							 =  ['''stem'''] + [F'''stage{idx}''' for idx in range(1				,		len(__a) + 1)]
							_UpperCamelCase ,  _UpperCamelCase							 =  get_aligned_output_features_output_indices(
							    out_features=__a				,		out_indices=__a				,		stage_names=self.stage_names)








"""simple docstring"""





import datasets


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

_a														=		"""\
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).
"""

_a														=		"""
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       lowerCamelCase__		(			__snake_case,     __snake_case	)							->		str:


					"""simple docstring"""





					return (preds == labels).mean()






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



		def 						UpperCAmelCase							(					self)       ->       Dict:






							'''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 						UpperCAmelCase							(					self				,		__a				,		__a)       ->       Dict:






							'''simple docstring'''
							return {"accuracy": simple_accuracy(__a				,		__a)}






