


"""simple docstring"""






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


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

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






class      A(  lowerCamelCase__		):

		"""simple docstring"""





		A    =							"nllb-moe"
		A    =							["past_key_values"]
		A    =							{"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}
		def __init__( self					,				SCREAMING_SNAKE_CASE__=12_81_12					,				SCREAMING_SNAKE_CASE__=10_24					,				SCREAMING_SNAKE_CASE__=12					,				SCREAMING_SNAKE_CASE__=40_96					,				SCREAMING_SNAKE_CASE__=16					,				SCREAMING_SNAKE_CASE__=12					,				SCREAMING_SNAKE_CASE__=40_96					,				SCREAMING_SNAKE_CASE__=16					,				SCREAMING_SNAKE_CASE__=0.0_5					,				SCREAMING_SNAKE_CASE__=0.0_5					,				SCREAMING_SNAKE_CASE__=True					,				SCREAMING_SNAKE_CASE__=True					,				SCREAMING_SNAKE_CASE__="relu"					,				SCREAMING_SNAKE_CASE__=10_24					,				SCREAMING_SNAKE_CASE__=0.1					,				SCREAMING_SNAKE_CASE__=0.1					,				SCREAMING_SNAKE_CASE__=0.0					,				SCREAMING_SNAKE_CASE__=0.0_2					,				SCREAMING_SNAKE_CASE__=2					,				SCREAMING_SNAKE_CASE__=True					,				SCREAMING_SNAKE_CASE__=False					,				SCREAMING_SNAKE_CASE__="float32"					,				SCREAMING_SNAKE_CASE__=False					,				SCREAMING_SNAKE_CASE__=1_28					,				SCREAMING_SNAKE_CASE__=64					,				SCREAMING_SNAKE_CASE__=4					,				SCREAMING_SNAKE_CASE__=4					,				SCREAMING_SNAKE_CASE__=0.0_0_1					,				SCREAMING_SNAKE_CASE__=0.0_0_1					,				SCREAMING_SNAKE_CASE__="all"					,				SCREAMING_SNAKE_CASE__=False					,				SCREAMING_SNAKE_CASE__=False					,				SCREAMING_SNAKE_CASE__=1.0					,				SCREAMING_SNAKE_CASE__=0.2					,				SCREAMING_SNAKE_CASE__=1					,				SCREAMING_SNAKE_CASE__=0					,				SCREAMING_SNAKE_CASE__=2					,				SCREAMING_SNAKE_CASE__=False					,				**SCREAMING_SNAKE_CASE__					,				)      ->	Dict:

					"""simple docstring"""



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

					_UpperCamelCase					:str					     =	router_ignore_padding_tokens
					_UpperCamelCase					:Any					     =	batch_prioritized_routing
					_UpperCamelCase					:Any					     =	second_expert_policy
					_UpperCamelCase					:str					     =	normalize_router_prob_before_dropping
					_UpperCamelCase					:List[Any]					     =	moe_eval_capacity_token_fraction
					_UpperCamelCase					:Tuple					     =	moe_token_dropout
					_UpperCamelCase					:List[str]					     =	output_router_logits
					super().__init__(
					    pad_token_id=SCREAMING_SNAKE_CASE__					,				bos_token_id=SCREAMING_SNAKE_CASE__					,				eos_token_id=SCREAMING_SNAKE_CASE__					,				is_encoder_decoder=SCREAMING_SNAKE_CASE__					,				decoder_start_token_id=SCREAMING_SNAKE_CASE__					,				**SCREAMING_SNAKE_CASE__					,				)





"""simple docstring"""






from collections.abc import Callable

import numpy as np





def 				A_       ( snake_case__       ,					snake_case__       ,					snake_case__       ,					snake_case__       ,					snake_case__		)					->  np.ndarray:
			_UpperCamelCase					:str					     =	int(np.ceil((x_end - xa) / step_size		)		)
			_UpperCamelCase					:Union[str, Any]					     =	np.zeros((n + 1,)		)
			_UpperCamelCase					:List[str]					     =	ya
			_UpperCamelCase					:Any					     =	xa

			for k in range(snake_case__		):
						_UpperCamelCase					:Union[str, Any]					     =	y[k] + step_size * ode_func(snake_case__       ,					y[k]		)
						x += step_size

			return y


if __name__ == "__main__":
					import doctest

					doctest.testmod()

