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


_SCREAMING_SNAKE_CASE    :      Optional[int]          =			logging.get_logger(__name__)

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







class  UpperCamelCase__		(    SCREAMING_SNAKE_CASE_   ):







	'''simple docstring'''
	_lowerCAmelCase							       =				"nllb-moe"
	_lowerCAmelCase							       =				["past_key_values"]
	_lowerCAmelCase							       =				{"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}





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

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

import numpy as np

_SCREAMING_SNAKE_CASE    :      Any          =			[
    ['a', 'b', 'c', 'd', 'e'],
    ['f', 'g', 'h', 'i', 'k'],
    ['l', 'm', 'n', 'o', 'p'],
    ['q', 'r', 's', 't', 'u'],
    ['v', 'w', 'x', 'y', 'z'],
]







class  UpperCamelCase__		:







	'''simple docstring'''





	def __init__(			self		):
					A__  :	List[Any]         =							np.array(UpperCamelCase__		)





	def   __snake_case				(			self				,       UpperCamelCase__		):
					A__       ,							A__  :	Any         =							np.where(letter == self.SQUARE		)
					A__  :	int         =							np.concatenate([indexa + 1, indexa + 1]		)
					return indexes





	def   __snake_case				(			self				,       UpperCamelCase__				,       UpperCamelCase__		):
					A__  :	Union[str, Any]         =							self.SQUARE[indexa - 1, indexa - 1]
					return letter





	def   __snake_case				(			self				,       UpperCamelCase__		):
					A__  :	List[str]         =							message.lower()
					A__  :	str         =							message.replace(''' '''				,       ''''''		)
					A__  :	Union[str, Any]         =							message.replace('''j'''				,       '''i'''		)

					A__  :	List[Any]         =							np.empty((2, len(UpperCamelCase__		))		)
					for letter_index in range(len(UpperCamelCase__		)		):
									A__  :	Any         =							self.letter_to_numbers(message[letter_index]		)

									A__  :	Optional[Any]         =							numbers[0]
									A__  :	List[str]         =							numbers[1]

					A__  :	List[str]         =							first_step.reshape(2 * len(UpperCamelCase__		)		)
					A__  :	List[Any]         =							''''''
					for numbers_index in range(len(UpperCamelCase__		)		):
									A__  :	Dict         =							int(second_step[numbers_index * 2]		)
									A__  :	List[str]         =							int(second_step[(numbers_index * 2) + 1]		)
									A__  :	Dict         =							self.numbers_to_letter(UpperCamelCase__				,       UpperCamelCase__		)
									A__  :	Tuple         =							encoded_message + letter

					return encoded_message





	def   __snake_case				(			self				,       UpperCamelCase__		):
					A__  :	str         =							message.lower()
					message.replace(''' '''				,       ''''''		)
					A__  :	List[Any]         =							np.empty(2 * len(UpperCamelCase__		)		)
					for letter_index in range(len(UpperCamelCase__		)		):
									A__  :	List[str]         =							self.letter_to_numbers(message[letter_index]		)
									A__  :	Dict         =							numbers[0]
									A__  :	int         =							numbers[1]

					A__  :	Optional[Any]         =							first_step.reshape((2, len(UpperCamelCase__		))		)
					A__  :	int         =							''''''
					for numbers_index in range(len(UpperCamelCase__		)		):
									A__  :	Tuple         =							int(second_step[0, numbers_index]		)
									A__  :	Dict         =							int(second_step[1, numbers_index]		)
									A__  :	List[str]         =							self.numbers_to_letter(UpperCamelCase__				,       UpperCamelCase__		)
									A__  :	Tuple         =							decoded_message + letter

					return decoded_message