



'''simple docstring'''


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


lowercase_      :				Any   					=    logging.get_logger(__name__)

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




class      __UpperCamelCase       (_UpperCAmelCase			):
	__A			  =					'''nllb-moe'''
	__A			  =					['''past_key_values''']
	__A			  =					{'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}







	def __init__(    self ,				_lowerCAmelCase=12_8112 ,				_lowerCAmelCase=1024 ,				_lowerCAmelCase=12 ,				_lowerCAmelCase=4096 ,				_lowerCAmelCase=16 ,				_lowerCAmelCase=12 ,				_lowerCAmelCase=4096 ,				_lowerCAmelCase=16 ,				_lowerCAmelCase=0.05 ,				_lowerCAmelCase=0.05 ,				_lowerCAmelCase=True ,				_lowerCAmelCase=True ,				_lowerCAmelCase="relu" ,				_lowerCAmelCase=1024 ,				_lowerCAmelCase=0.1 ,				_lowerCAmelCase=0.1 ,				_lowerCAmelCase=0.0 ,				_lowerCAmelCase=0.02 ,				_lowerCAmelCase=2 ,				_lowerCAmelCase=True ,				_lowerCAmelCase=False ,				_lowerCAmelCase="float32" ,				_lowerCAmelCase=False ,				_lowerCAmelCase=128 ,				_lowerCAmelCase=64 ,				_lowerCAmelCase=4 ,				_lowerCAmelCase=4 ,				_lowerCAmelCase=0.001 ,				_lowerCAmelCase=0.001 ,				_lowerCAmelCase="all" ,				_lowerCAmelCase=False ,				_lowerCAmelCase=False ,				_lowerCAmelCase=1.0 ,				_lowerCAmelCase=0.2 ,				_lowerCAmelCase=1 ,				_lowerCAmelCase=0 ,				_lowerCAmelCase=2 ,				_lowerCAmelCase=False ,				**_lowerCAmelCase ,				)    ->    Dict:
							'''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=_lowerCAmelCase ,				bos_token_id=_lowerCAmelCase ,				eos_token_id=_lowerCAmelCase ,				is_encoder_decoder=_lowerCAmelCase ,				decoder_start_token_id=_lowerCAmelCase ,				**_lowerCAmelCase ,				)







'''simple docstring'''


def      SCREAMING_SNAKE_CASE				(				lowercase_    :      int ,  lowercase_    :      int ,  lowercase_    :      list[list[int]]						):

						def update_area_of_max_square(lowercase_    :      int ,  lowercase_    :      int						) -> int:
												# BASE CASE
												if row >= rows or col >= cols:
																		return 0

												lowercase        =							update_area_of_max_square(lowercase_ ,  col + 1						)
												lowercase        =							update_area_of_max_square(row + 1 ,  col + 1						)
												lowercase        =							update_area_of_max_square(row + 1 ,  lowercase_						)

												if mat[row][col]:
																		lowercase        =							1 + min([right, diagonal, down]						)
																		lowercase        =							max(largest_square_area[0] ,  lowercase_						)
																		return sub_problem_sol
												else:
																		return 0

						lowercase        =							[0]
						update_area_of_max_square(0 ,  0						)
						return largest_square_area[0]







def      SCREAMING_SNAKE_CASE				(				lowercase_    :      int ,  lowercase_    :      int ,  lowercase_    :      list[list[int]]						):

						def update_area_of_max_square_using_dp_array(
						    lowercase_    :      int ,  lowercase_    :      int ,  lowercase_    :      list[list[int]]						) -> int:
												if row >= rows or col >= cols:
																		return 0
												if dp_array[row][col] != -1:
																		return dp_array[row][col]

												lowercase        =							update_area_of_max_square_using_dp_array(lowercase_ ,  col + 1 ,  lowercase_						)
												lowercase        =							update_area_of_max_square_using_dp_array(row + 1 ,  col + 1 ,  lowercase_						)
												lowercase        =							update_area_of_max_square_using_dp_array(row + 1 ,  lowercase_ ,  lowercase_						)

												if mat[row][col]:
																		lowercase        =							1 + min([right, diagonal, down]						)
																		lowercase        =							max(largest_square_area[0] ,  lowercase_						)
																		lowercase        =							sub_problem_sol
																		return sub_problem_sol
												else:
																		return 0

						lowercase        =							[0]
						lowercase        =							[[-1] * cols for _ in range(lowercase_						)]
						update_area_of_max_square_using_dp_array(0 ,  0 ,  lowercase_						)

						return largest_square_area[0]







def      SCREAMING_SNAKE_CASE				(				lowercase_    :      int ,  lowercase_    :      int ,  lowercase_    :      list[list[int]]						):
						lowercase        =							[[0] * (cols + 1) for _ in range(rows + 1						)]
						lowercase        =							0
						for row in range(rows - 1 ,  -1 ,  -1						):
												for col in range(cols - 1 ,  -1 ,  -1						):
																		lowercase        =							dp_array[row][col + 1]
																		lowercase        =							dp_array[row + 1][col + 1]
																		lowercase        =							dp_array[row + 1][col]

																		if mat[row][col] == 1:
																								lowercase        =							1 + min(lowercase_ ,  lowercase_ ,  lowercase_						)
																								lowercase        =							max(dp_array[row][col] ,  lowercase_						)
																		else:
																								lowercase        =							0

						return largest_square_area







def      SCREAMING_SNAKE_CASE				(				lowercase_    :      int ,  lowercase_    :      int ,  lowercase_    :      list[list[int]]						):
						lowercase        =							[0] * (cols + 1)
						lowercase        =							[0] * (cols + 1)
						lowercase        =							0
						for row in range(rows - 1 ,  -1 ,  -1						):
												for col in range(cols - 1 ,  -1 ,  -1						):
																		lowercase        =							current_row[col + 1]
																		lowercase        =							next_row[col + 1]
																		lowercase        =							next_row[col]

																		if mat[row][col] == 1:
																								lowercase        =							1 + min(lowercase_ ,  lowercase_ ,  lowercase_						)
																								lowercase        =							max(current_row[col] ,  lowercase_						)
																		else:
																								lowercase        =							0
												lowercase        =							current_row

						return largest_square_area


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						print(largest_square_area_in_matrix_bottom_up(2, 2, [[1, 1], [1, 1]]))


