



'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging


snake_case_			:     List[Any]  	=  logging.get_logger(__name__)

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






class 							lowercase__     (							lowercase       ):
	lowercase__      =      """nllb-moe"""
	lowercase__      =      ["""past_key_values"""]
	lowercase__      =      {"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}





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







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

							_UpperCamelCase :		List[Any]			    =       router_ignore_padding_tokens
							_UpperCamelCase :		List[Any]			    =       batch_prioritized_routing
							_UpperCamelCase :		Tuple			    =       second_expert_policy
							_UpperCamelCase :		Dict			    =       normalize_router_prob_before_dropping
							_UpperCamelCase :		Optional[int]			    =       moe_eval_capacity_token_fraction
							_UpperCamelCase :		Dict			    =       moe_token_dropout
							_UpperCamelCase :		str			    =       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__			,)







'''simple docstring'''
from __future__ import annotations






def A__   (					UpperCAmelCase_							):
						if not nums:
												return 0
						_UpperCamelCase :		Any			    =       nums[0]
						_UpperCamelCase :		Optional[int]			    =       0
						for num in nums[1:]:
												_UpperCamelCase    ,      _UpperCamelCase :		Optional[Any]			    =       (
												    max_excluding + num,
												    max(UpperCAmelCase_  ,  UpperCAmelCase_							),
												)
						return max(UpperCAmelCase_  ,  UpperCAmelCase_							)


if __name__ == "__main__":
					import doctest

					doctest.testmod()


