



"""simple docstring"""





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    lowercase__     (					SCREAMING_SNAKE_CASE   ):







       '''simple docstring'''


       UpperCamelCase		=  '''nllb-moe'''
       UpperCamelCase		=  ['''past_key_values''']
       UpperCamelCase		=  {'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}



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


             '''simple docstring'''




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

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









"""simple docstring"""





lowerCamelCase      =		{
    "joule": 1.0,
    "kilojoule": 1_000,
    "megajoule": 1_000_000,
    "gigajoule": 1_000_000_000,
    "wattsecond": 1.0,
    "watthour": 3_600,
    "kilowatthour": 3_600_000,
    "newtonmeter": 1.0,
    "calorie_nutr": 4_186.8,
    "kilocalorie_nutr": 4_186_800.00,
    "electronvolt": 1.6_0_2_1_7_6_6_3_4e-1_9,
    "britishthermalunit_it": 1_055.05_585,
    "footpound": 1.355_818,
}
def      a__			(   lowerCAmelCase__			,    lowerCAmelCase__			,    lowerCAmelCase__   ):
      if to_type not in ENERGY_CONVERSION or from_type not in ENERGY_CONVERSION:
            UpperCAmelCase_    				=							(
                f"""Incorrect 'from_type' or 'to_type' value: {from_type!r}, {to_type!r}\n"""
                f"""Valid values are: {', '.join(lowerCAmelCase__   )}"""
            )
            raise ValueError(lowerCAmelCase__   )
      return value * ENERGY_CONVERSION[from_type] / ENERGY_CONVERSION[to_type]


if __name__ == "__main__":
  import doctest

  doctest.testmod()




