





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


A_												=     logging.get_logger(__name__)

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

class SCREAMING_SNAKE_CASE_ (					lowercase_   ):





					"""simple docstring"""


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

										lowerCamelCase__       =       router_ignore_padding_tokens
										lowerCamelCase__       =       batch_prioritized_routing
										lowerCamelCase__       =       second_expert_policy
										lowerCamelCase__       =       normalize_router_prob_before_dropping
										lowerCamelCase__       =       moe_eval_capacity_token_fraction
										lowerCamelCase__       =       moe_token_dropout
										lowerCamelCase__       =       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      (    a,     a) ->Optional[int]:
					lowerCamelCase__       =       [1]
					for i in range(2,     a):
										factorials.append(factorials[-1] * i)
					assert 0 <= k < factorials[-1] * n, "k out of bounds"

					lowerCamelCase__       =       []
					lowerCamelCase__       =       list(range(a))

					# Find permutation
					while factorials:
										lowerCamelCase__       =       factorials.pop()
										lowerCamelCase__    ,		lowerCamelCase__       =       divmod(a,     a)
										permutation.append(elements[number])
										elements.remove(elements[number])
					permutation.append(elements[0])

					return permutation


if __name__ == "__main__":
						import doctest

						doctest.testmod()

