



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


lowerCAmelCase__	    =    logging.get_logger(__name__)

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

class  snake_case__(_UpperCAmelCase     ):

					"""simple docstring"""






					lowercase_								=						'''nllb-moe'''
					lowercase_								=						['''past_key_values''']
					lowercase_								=						{'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}







					def __init__(				self   :      Optional[Any] ,  SCREAMING_SNAKE_CASE   :      List[str]=128_112 ,  SCREAMING_SNAKE_CASE   :      List[str]=1_024 ,  SCREAMING_SNAKE_CASE   :      Dict=12 ,  SCREAMING_SNAKE_CASE   :      int=4_096 ,  SCREAMING_SNAKE_CASE   :      Any=16 ,  SCREAMING_SNAKE_CASE   :      List[str]=12 ,  SCREAMING_SNAKE_CASE   :      int=4_096 ,  SCREAMING_SNAKE_CASE   :      Union[str, Any]=16 ,  SCREAMING_SNAKE_CASE   :      List[Any]=0.05 ,  SCREAMING_SNAKE_CASE   :      Dict=0.05 ,  SCREAMING_SNAKE_CASE   :      int=True ,  SCREAMING_SNAKE_CASE   :      str=True ,  SCREAMING_SNAKE_CASE   :      Any="relu" ,  SCREAMING_SNAKE_CASE   :      Dict=1_024 ,  SCREAMING_SNAKE_CASE   :      List[Any]=0.1 ,  SCREAMING_SNAKE_CASE   :      Any=0.1 ,  SCREAMING_SNAKE_CASE   :      Dict=0.0 ,  SCREAMING_SNAKE_CASE   :      int=0.02 ,  SCREAMING_SNAKE_CASE   :      int=2 ,  SCREAMING_SNAKE_CASE   :      List[str]=True ,  SCREAMING_SNAKE_CASE   :      Any=False ,  SCREAMING_SNAKE_CASE   :      Union[str, Any]="float32" ,  SCREAMING_SNAKE_CASE   :      Tuple=False ,  SCREAMING_SNAKE_CASE   :      Tuple=128 ,  SCREAMING_SNAKE_CASE   :      List[str]=64 ,  SCREAMING_SNAKE_CASE   :      Tuple=4 ,  SCREAMING_SNAKE_CASE   :      List[Any]=4 ,  SCREAMING_SNAKE_CASE   :      Tuple=0.001 ,  SCREAMING_SNAKE_CASE   :      str=0.001 ,  SCREAMING_SNAKE_CASE   :      List[Any]="all" ,  SCREAMING_SNAKE_CASE   :      int=False ,  SCREAMING_SNAKE_CASE   :      Dict=False ,  SCREAMING_SNAKE_CASE   :      Tuple=1.0 ,  SCREAMING_SNAKE_CASE   :      Tuple=0.2 ,  SCREAMING_SNAKE_CASE   :      List[str]=1 ,  SCREAMING_SNAKE_CASE   :      List[str]=0 ,  SCREAMING_SNAKE_CASE   :      Tuple=2 ,  SCREAMING_SNAKE_CASE   :      List[str]=False ,  **SCREAMING_SNAKE_CASE   :      List[str] ,  ):
									lowercase__	:       int						=	vocab_size
									lowercase__	:       Optional[Any]						=	max_position_embeddings
									lowercase__	:       Any						=	d_model
									lowercase__	:       List[Any]						=	encoder_ffn_dim
									lowercase__	:       str						=	encoder_layers
									lowercase__	:       List[str]						=	encoder_attention_heads
									lowercase__	:       List[str]						=	decoder_ffn_dim
									lowercase__	:       Tuple						=	decoder_layers
									lowercase__	:       List[Any]						=	decoder_attention_heads
									lowercase__	:       List[Any]						=	dropout
									lowercase__	:       Any						=	attention_dropout
									lowercase__	:       int						=	activation_dropout
									lowercase__	:       List[str]						=	activation_function
									lowercase__	:       Optional[Any]						=	init_std
									lowercase__	:       List[Any]						=	encoder_layerdrop
									lowercase__	:       str						=	decoder_layerdrop
									lowercase__	:       List[str]						=	use_cache
									lowercase__	:       Tuple						=	encoder_layers
									lowercase__	:       Dict						=	scale_embedding  # scale factor will be sqrt(d_model) if True
									lowercase__	:       Optional[Any]						=	router_z_loss_coef
									lowercase__	:       Dict						=	router_aux_loss_coef
									lowercase__	:       str						=	decoder_sparse_step
									lowercase__	:       int						=	encoder_sparse_step
									lowercase__	:       Tuple						=	num_experts
									lowercase__	:       Dict						=	expert_capacity
									lowercase__	:       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}"""	)
									lowercase__	:       int						=	router_dtype

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





def 							UpperCAmelCase		(       lowercase				,     lowercase				):







				"""simple docstring"""



				__lowercase					     =				len(lowercase				)
				__lowercase					     =				len(lowercase				)
				__lowercase					     =				[[False for _ in range(m + 1				)] for _ in range(n + 1				)]
				__lowercase					     =				True
				for i in range(lowercase				):
								for j in range(m + 1				):
												if dp[i][j]:
																if j < m and a[i].upper() == b[j]:
																				__lowercase					     =				True
																if a[i].islower():
																				__lowercase					     =				True
				return dp[n][m]


if __name__ == "__main__":
		import doctest

		doctest.testmod()