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


__lowerCamelCase    :				Optional[int]							     =	logging.get_logger(__name__)

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







class __snake_case       (		lowerCamelCase_	):
   lowerCAmelCase_														=							"nllb-moe"
   lowerCAmelCase_														=							["past_key_values"]
   lowerCAmelCase_														=							{"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}




   def __init__(					self    :       int ,			_lowercase    :       Tuple=12_81_12 ,			_lowercase    :       List[Any]=10_24 ,			_lowercase    :       Any=12 ,			_lowercase    :       List[Any]=40_96 ,			_lowercase    :       str=16 ,			_lowercase    :       str=12 ,			_lowercase    :       Optional[int]=40_96 ,			_lowercase    :       List[Any]=16 ,			_lowercase    :       str=0.05 ,			_lowercase    :       Tuple=0.05 ,			_lowercase    :       str=True ,			_lowercase    :       List[str]=True ,			_lowercase    :       Optional[Any]="relu" ,			_lowercase    :       str=10_24 ,			_lowercase    :       Tuple=0.1 ,			_lowercase    :       int=0.1 ,			_lowercase    :       Dict=0.0 ,			_lowercase    :       List[str]=0.02 ,			_lowercase    :       int=2 ,			_lowercase    :       Optional[Any]=True ,			_lowercase    :       List[Any]=False ,			_lowercase    :       List[str]="float32" ,			_lowercase    :       Optional[Any]=False ,			_lowercase    :       str=1_28 ,			_lowercase    :       int=64 ,			_lowercase    :       Optional[int]=4 ,			_lowercase    :       List[str]=4 ,			_lowercase    :       Union[str, Any]=0.0_01 ,			_lowercase    :       List[Any]=0.0_01 ,			_lowercase    :       List[str]="all" ,			_lowercase    :       Optional[Any]=False ,			_lowercase    :       int=False ,			_lowercase    :       Tuple=1.0 ,			_lowercase    :       Optional[int]=0.2 ,			_lowercase    :       Optional[int]=1 ,			_lowercase    :       List[Any]=0 ,			_lowercase    :       List[Any]=2 ,			_lowercase    :       int=False ,			**_lowercase    :       Union[str, Any] ,			):



     """simple docstring"""






     SCREAMING_SNAKE_CASE__    							=   vocab_size
     SCREAMING_SNAKE_CASE__    							=   max_position_embeddings
     SCREAMING_SNAKE_CASE__    							=   d_model
     SCREAMING_SNAKE_CASE__    							=   encoder_ffn_dim
     SCREAMING_SNAKE_CASE__    							=   encoder_layers
     SCREAMING_SNAKE_CASE__    							=   encoder_attention_heads
     SCREAMING_SNAKE_CASE__    							=   decoder_ffn_dim
     SCREAMING_SNAKE_CASE__    							=   decoder_layers
     SCREAMING_SNAKE_CASE__    							=   decoder_attention_heads
     SCREAMING_SNAKE_CASE__    							=   dropout
     SCREAMING_SNAKE_CASE__    							=   attention_dropout
     SCREAMING_SNAKE_CASE__    							=   activation_dropout
     SCREAMING_SNAKE_CASE__    							=   activation_function
     SCREAMING_SNAKE_CASE__    							=   init_std
     SCREAMING_SNAKE_CASE__    							=   encoder_layerdrop
     SCREAMING_SNAKE_CASE__    							=   decoder_layerdrop
     SCREAMING_SNAKE_CASE__    							=   use_cache
     SCREAMING_SNAKE_CASE__    							=   encoder_layers
     SCREAMING_SNAKE_CASE__    							=   scale_embedding  # scale factor will be sqrt(d_model) if True
     SCREAMING_SNAKE_CASE__    							=   router_z_loss_coef
     SCREAMING_SNAKE_CASE__    							=   router_aux_loss_coef
     SCREAMING_SNAKE_CASE__    							=   decoder_sparse_step
     SCREAMING_SNAKE_CASE__    							=   encoder_sparse_step
     SCREAMING_SNAKE_CASE__    							=   num_experts
     SCREAMING_SNAKE_CASE__    							=   expert_capacity
     SCREAMING_SNAKE_CASE__    							=   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}"""   )
     SCREAMING_SNAKE_CASE__    							=   router_dtype

     SCREAMING_SNAKE_CASE__    							=   router_ignore_padding_tokens
     SCREAMING_SNAKE_CASE__    							=   batch_prioritized_routing
     SCREAMING_SNAKE_CASE__    							=   second_expert_policy
     SCREAMING_SNAKE_CASE__    							=   normalize_router_prob_before_dropping
     SCREAMING_SNAKE_CASE__    							=   moe_eval_capacity_token_fraction
     SCREAMING_SNAKE_CASE__    							=   moe_token_dropout
     SCREAMING_SNAKE_CASE__    							=   output_router_logits
     super().__init__(
         pad_token_id=_lowercase ,			bos_token_id=_lowercase ,			eos_token_id=_lowercase ,			is_encoder_decoder=_lowercase ,			decoder_start_token_id=_lowercase ,			**_lowercase ,			)

import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import ClassLabel, Features, Value
from .base import TaskTemplate







@dataclass(frozen=lowerCamelCase_	)
class __snake_case       (		lowerCamelCase_	):
   # `task` is not a ClassVar since we want it to be part of the `asdict` output for JSON serialization
   lowerCAmelCase_														=							field(default="text-classification"     ,	metadata={"include_in_asdict_even_if_is_default": True}	)
   lowerCAmelCase_														=							Features({"text": Value("string"	)}	)
   lowerCAmelCase_														=							Features({"labels": ClassLabel}	)
   lowerCAmelCase_														=							"text"
   lowerCAmelCase_														=							"labels"




   def 			__a		(					self    :       Dict ,			_lowercase    :       List[Any]   ):



     """simple docstring"""






     if self.label_column not in features:
       raise ValueError(f"""Column {self.label_column} is not present in features."""   )
     if not isinstance(features[self.label_column] ,			_lowercase   ):
       raise ValueError(f"""Column {self.label_column} is not a ClassLabel."""   )
     SCREAMING_SNAKE_CASE__    							=   copy.deepcopy(self   )
     SCREAMING_SNAKE_CASE__    							=   self.label_schema.copy()
     SCREAMING_SNAKE_CASE__    							=   features[self.label_column]
     SCREAMING_SNAKE_CASE__    							=   label_schema
     return task_template




   @property
   def 			__a		(					self    :       List[Any]   ):



     """simple docstring"""






     return {
         self.text_column: "text",
         self.label_column: "labels",
     }
