




"""simple docstring"""





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


A   =       logging.get_logger(__name__)

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



class      a__				(	__magic_name__   ):
			lowercase_    =	"nllb-moe"
			lowercase_    =	["past_key_values"]
			lowercase_    =	{"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}


			def __init__(      self      :    Dict      ,  UpperCamelCase_      :    Optional[int]=128112      ,  UpperCamelCase_      :    Any=1024      ,  UpperCamelCase_      :    Union[str, Any]=12      ,  UpperCamelCase_      :    Optional[int]=4096      ,  UpperCamelCase_      :    str=16      ,  UpperCamelCase_      :    Union[str, Any]=12      ,  UpperCamelCase_      :    Union[str, Any]=4096      ,  UpperCamelCase_      :    Optional[Any]=16      ,  UpperCamelCase_      :    Optional[Any]=0.05      ,  UpperCamelCase_      :    Dict=0.05      ,  UpperCamelCase_      :    Optional[Any]=True      ,  UpperCamelCase_      :    Tuple=True      ,  UpperCamelCase_      :    Any="relu"      ,  UpperCamelCase_      :    Dict=1024      ,  UpperCamelCase_      :    List[str]=0.1      ,  UpperCamelCase_      :    Any=0.1      ,  UpperCamelCase_      :    int=0.0      ,  UpperCamelCase_      :    Any=0.02      ,  UpperCamelCase_      :    Dict=2      ,  UpperCamelCase_      :    Union[str, Any]=True      ,  UpperCamelCase_      :    Optional[Any]=False      ,  UpperCamelCase_      :    List[Any]="float32"      ,  UpperCamelCase_      :    Optional[int]=False      ,  UpperCamelCase_      :    int=128      ,  UpperCamelCase_      :    Optional[int]=64      ,  UpperCamelCase_      :    Optional[int]=4      ,  UpperCamelCase_      :    Optional[int]=4      ,  UpperCamelCase_      :    str=0.001      ,  UpperCamelCase_      :    Union[str, Any]=0.001      ,  UpperCamelCase_      :    List[str]="all"      ,  UpperCamelCase_      :    Union[str, Any]=False      ,  UpperCamelCase_      :    Any=False      ,  UpperCamelCase_      :    Any=1.0      ,  UpperCamelCase_      :    Tuple=0.2      ,  UpperCamelCase_      :    Any=1      ,  UpperCamelCase_      :    Dict=0      ,  UpperCamelCase_      :    Any=2      ,  UpperCamelCase_      :    Tuple=False      ,  **UpperCamelCase_      :    Optional[Any]      ,  ):


						"""simple docstring"""




						__UpperCAmelCase	: Optional[Any]		=					vocab_size
						__UpperCAmelCase	: List[str]		=					max_position_embeddings
						__UpperCAmelCase	: Dict		=					d_model
						__UpperCAmelCase	: Union[str, Any]		=					encoder_ffn_dim
						__UpperCAmelCase	: str		=					encoder_layers
						__UpperCAmelCase	: int		=					encoder_attention_heads
						__UpperCAmelCase	: List[str]		=					decoder_ffn_dim
						__UpperCAmelCase	: int		=					decoder_layers
						__UpperCAmelCase	: Union[str, Any]		=					decoder_attention_heads
						__UpperCAmelCase	: str		=					dropout
						__UpperCAmelCase	: Dict		=					attention_dropout
						__UpperCAmelCase	: Optional[Any]		=					activation_dropout
						__UpperCAmelCase	: Any		=					activation_function
						__UpperCAmelCase	: Dict		=					init_std
						__UpperCAmelCase	: Union[str, Any]		=					encoder_layerdrop
						__UpperCAmelCase	: Optional[int]		=					decoder_layerdrop
						__UpperCAmelCase	: Any		=					use_cache
						__UpperCAmelCase	: Optional[int]		=					encoder_layers
						__UpperCAmelCase	: List[str]		=					scale_embedding  # scale factor will be sqrt(d_model) if True
						__UpperCAmelCase	: Tuple		=					router_z_loss_coef
						__UpperCAmelCase	: List[Any]		=					router_aux_loss_coef
						__UpperCAmelCase	: List[str]		=					decoder_sparse_step
						__UpperCAmelCase	: List[Any]		=					encoder_sparse_step
						__UpperCAmelCase	: Optional[int]		=					num_experts
						__UpperCAmelCase	: Optional[int]		=					expert_capacity
						__UpperCAmelCase	: List[Any]		=					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}")
						__UpperCAmelCase	: str		=					router_dtype

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








"""simple docstring"""





def 					_UpperCamelCase    (			UpperCamelCase				,       UpperCamelCase				,       UpperCamelCase							)			->			int:


			"""simple docstring"""

			if exponent == 1:
						return base
			if exponent % 2 == 0:
						__UpperCAmelCase	: Union[str, Any]		=					_modexpt(UpperCamelCase				,       exponent // 2				,       UpperCamelCase							) % modulo_value
						return (x * x) % modulo_value
			else:
						return (base * _modexpt(UpperCamelCase				,       exponent - 1				,       UpperCamelCase							)) % modulo_value

def 					_UpperCamelCase    (			UpperCamelCase = 1777				,       UpperCamelCase = 1855				,       UpperCamelCase = 8							)			->			int:


			"""simple docstring"""
			__UpperCAmelCase	: Optional[int]		=					base
			for _ in range(1				,       UpperCamelCase							):
						__UpperCAmelCase	: str		=					_modexpt(UpperCamelCase				,       UpperCamelCase				,       10**digits							)

			return result


if __name__ == "__main__":
					print(f'''{solution() = }''')


