


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        _a							(			UpperCamelCase__			):
							_lowercase	:			List[str]        = '''nllb-moe'''
							_lowercase	:			List[Any]        = ['''past_key_values''']
							_lowercase	:			List[Any]        = {'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}

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





									"""simple docstring"""







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

									lowercase__            =      router_ignore_padding_tokens
									lowercase__            =      batch_prioritized_routing
									lowercase__            =      second_expert_policy
									lowercase__            =      normalize_router_prob_before_dropping
									lowercase__            =      moe_eval_capacity_token_fraction
									lowercase__            =      moe_token_dropout
									lowercase__            =      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_    ,						)






class        _a							:

							def __init__(							self:	Any							)			->   Tuple:





									"""simple docstring"""







									lowercase__            =      ''''''
									lowercase__            =      ''''''
									lowercase__            =      []

							def       lowerCamelCase_ (							self:	Union[str, Any]    ,						UpperCamelCase_:	int    ,						UpperCamelCase_:	int							)			->   int:





									"""simple docstring"""







									if m == -1:
											return n + 1
									elif n == -1:
											return m + 1
									elif self.dp[m][n] > -1:
											return self.dp[m][n]
									else:
											if self.worda[m] == self.worda[n]:
													lowercase__            =      self.__min_dist_top_down_dp(m - 1    ,						n - 1							)
											else:
													lowercase__            =      self.__min_dist_top_down_dp(UpperCamelCase_    ,						n - 1							)
													lowercase__            =      self.__min_dist_top_down_dp(m - 1    ,						UpperCamelCase_							)
													lowercase__            =      self.__min_dist_top_down_dp(m - 1    ,						n - 1							)
													lowercase__            =      1 + min(UpperCamelCase_    ,						UpperCamelCase_    ,						UpperCamelCase_							)

											return self.dp[m][n]

							def       lowerCamelCase_ (							self:	Union[str, Any]    ,						UpperCamelCase_:	str    ,						UpperCamelCase_:	str							)			->   int:





									"""simple docstring"""







									lowercase__            =      worda
									lowercase__            =      worda
									lowercase__            =      [[-1 for _ in range(len(UpperCamelCase_							)							)] for _ in range(len(UpperCamelCase_							)							)]

									return self.__min_dist_top_down_dp(len(UpperCamelCase_							) - 1    ,						len(UpperCamelCase_							) - 1							)


							def       lowerCamelCase_ (							self:	int    ,						UpperCamelCase_:	str    ,						UpperCamelCase_:	str							)			->   int:





									"""simple docstring"""







									lowercase__            =      worda
									lowercase__            =      worda
									lowercase__            =      len(UpperCamelCase_							)
									lowercase__            =      len(UpperCamelCase_							)
									lowercase__            =      [[0 for _ in range(n + 1							)] for _ in range(m + 1							)]

									for i in range(m + 1							):
											for j in range(n + 1							):
													if i == 0:  # first string is empty
															lowercase__            =      j
													elif j == 0:  # second string is empty
															lowercase__            =      i
													elif worda[i - 1] == worda[j - 1]:  # last characters are equal
															lowercase__            =      self.dp[i - 1][j - 1]
													else:
															lowercase__            =      self.dp[i][j - 1]
															lowercase__            =      self.dp[i - 1][j]
															lowercase__            =      self.dp[i - 1][j - 1]
															lowercase__            =      1 + min(UpperCamelCase_    ,						UpperCamelCase_    ,						UpperCamelCase_							)
									return self.dp[m][n]


if __name__ == "__main__":
			lowerCAmelCase       =							EditDistance()

			print('****************** Testing Edit Distance DP Algorithm ******************')
			print()

			lowerCAmelCase       =							input('Enter the first string: ').strip()
			lowerCAmelCase       =							input('Enter the second string: ').strip()

			print()
			print(f"""The minimum edit distance is: {solver.min_dist_top_down(Sa, Sa)}""")
			print(f"""The minimum edit distance is: {solver.min_dist_bottom_up(Sa, Sa)}""")
			print()
			print('*************** End of Testing Edit Distance DP Algorithm ***************')


