


import datasets


__UpperCamelCase    :						int     =							'\\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    :						Union[str, Any]     =							'\\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    :						List[Any]     =							'\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       (     UpperCAmelCase      :			Union[str, Any]						,	UpperCAmelCase      :			Any      ):
      """simple docstring"""




      return (preds == labels).mean()




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

   '''simple docstring'''







   def   _snake_case    (  self  : Optional[Any]							):






         '''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  : str       ,  _lowerCamelCase  : Dict       ,  _lowerCamelCase  : Optional[Any]							):






         '''simple docstring'''



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







from ...configuration_utils import PretrainedConfig
from ...utils import logging


__UpperCamelCase    :						Tuple     =							logging.get_logger(__name__)

__UpperCamelCase    :						Any     =							{
    'facebook/nllb-moe-54B': 'https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json',
}



class 							_UpperCamelCase (						A						):

   '''simple docstring'''







   a_				:							int    = "nllb-moe"
   a_				:							Optional[int]    = ["past_key_values"]
   a_				:							Optional[Any]    = {"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}

   def __init__(  self  : int       ,  _lowerCamelCase  : Union[str, Any]=1_2_8_1_1_2       ,  _lowerCamelCase  : List[str]=1_0_2_4       ,  _lowerCamelCase  : Optional[int]=1_2       ,  _lowerCamelCase  : int=4_0_9_6       ,  _lowerCamelCase  : Union[str, Any]=1_6       ,  _lowerCamelCase  : int=1_2       ,  _lowerCamelCase  : Optional[int]=4_0_9_6       ,  _lowerCamelCase  : Any=1_6       ,  _lowerCamelCase  : Any=0.05       ,  _lowerCamelCase  : List[Any]=0.05       ,  _lowerCamelCase  : Tuple=True       ,  _lowerCamelCase  : Any=True       ,  _lowerCamelCase  : Optional[int]="relu"       ,  _lowerCamelCase  : Dict=1_0_2_4       ,  _lowerCamelCase  : Optional[int]=0.1       ,  _lowerCamelCase  : Optional[int]=0.1       ,  _lowerCamelCase  : Optional[int]=0.0       ,  _lowerCamelCase  : List[Any]=0.02       ,  _lowerCamelCase  : List[str]=2       ,  _lowerCamelCase  : List[str]=True       ,  _lowerCamelCase  : Union[str, Any]=False       ,  _lowerCamelCase  : Optional[Any]="float32"       ,  _lowerCamelCase  : Union[str, Any]=False       ,  _lowerCamelCase  : Tuple=1_2_8       ,  _lowerCamelCase  : Dict=6_4       ,  _lowerCamelCase  : Any=4       ,  _lowerCamelCase  : List[Any]=4       ,  _lowerCamelCase  : str=0.001       ,  _lowerCamelCase  : Dict=0.001       ,  _lowerCamelCase  : Any="all"       ,  _lowerCamelCase  : Optional[Any]=False       ,  _lowerCamelCase  : List[Any]=False       ,  _lowerCamelCase  : Optional[Any]=1.0       ,  _lowerCamelCase  : List[str]=0.2       ,  _lowerCamelCase  : List[Any]=1       ,  _lowerCamelCase  : str=0       ,  _lowerCamelCase  : int=2       ,  _lowerCamelCase  : int=False       ,  **_lowerCamelCase  : List[str]       ,  ):






         '''simple docstring'''



         __lowerCamelCase     :      Optional[Any]       						=						vocab_size
         __lowerCamelCase     :      str       						=						max_position_embeddings
         __lowerCamelCase     :      int       						=						d_model
         __lowerCamelCase     :      Optional[Any]       						=						encoder_ffn_dim
         __lowerCamelCase     :      str       						=						encoder_layers
         __lowerCamelCase     :      Tuple       						=						encoder_attention_heads
         __lowerCamelCase     :      Union[str, Any]       						=						decoder_ffn_dim
         __lowerCamelCase     :      Dict       						=						decoder_layers
         __lowerCamelCase     :      Any       						=						decoder_attention_heads
         __lowerCamelCase     :      Union[str, Any]       						=						dropout
         __lowerCamelCase     :      Dict       						=						attention_dropout
         __lowerCamelCase     :      int       						=						activation_dropout
         __lowerCamelCase     :      Union[str, Any]       						=						activation_function
         __lowerCamelCase     :      Optional[int]       						=						init_std
         __lowerCamelCase     :      Union[str, Any]       						=						encoder_layerdrop
         __lowerCamelCase     :      Dict       						=						decoder_layerdrop
         __lowerCamelCase     :      List[str]       						=						use_cache
         __lowerCamelCase     :      Any       						=						encoder_layers
         __lowerCamelCase     :      List[Any]       						=						scale_embedding  # scale factor will be sqrt(d_model) if True
         __lowerCamelCase     :      Optional[Any]       						=						router_z_loss_coef
         __lowerCamelCase     :      Union[str, Any]       						=						router_aux_loss_coef
         __lowerCamelCase     :      Dict       						=						decoder_sparse_step
         __lowerCamelCase     :      Optional[int]       						=						encoder_sparse_step
         __lowerCamelCase     :      Any       						=						num_experts
         __lowerCamelCase     :      int       						=						expert_capacity
         __lowerCamelCase     :      Dict       						=						router_bias
         if router_dtype not in ["float32", "float16", "bfloat16"]:
               raise ValueError(F"""`router_dtype` must be one of 'float32', 'float16' or 'bfloat16', got {router_dtype}"""							)
         __lowerCamelCase     :      Tuple       						=						router_dtype

         __lowerCamelCase     :      Dict       						=						router_ignore_padding_tokens
         __lowerCamelCase     :      str       						=						batch_prioritized_routing
         __lowerCamelCase     :      List[str]       						=						second_expert_policy
         __lowerCamelCase     :      Tuple       						=						normalize_router_prob_before_dropping
         __lowerCamelCase     :      Dict       						=						moe_eval_capacity_token_fraction
         __lowerCamelCase     :      Optional[int]       						=						moe_token_dropout
         __lowerCamelCase     :      Dict       						=						output_router_logits
         super().__init__(
             pad_token_id=_lowerCamelCase       ,  bos_token_id=_lowerCamelCase       ,  eos_token_id=_lowerCamelCase       ,  is_encoder_decoder=_lowerCamelCase       ,  decoder_start_token_id=_lowerCamelCase       ,  **_lowerCamelCase       ,  )



