'''simple docstring'''






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


_UpperCAmelCase    :     Dict         =       logging.get_logger(__name__)

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







class lowercase_       (		_UpperCamelCase			):







   """simple docstring"""

   __lowerCAmelCase         =   "nllb-moe"
   __lowerCAmelCase         =   ["past_key_values"]
   __lowerCAmelCase         =   {"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}
   def __init__(      self      :			List[Any], UpperCamelCase__      :			str=12_81_12, UpperCamelCase__      :			str=10_24, UpperCamelCase__      :			Optional[int]=12, UpperCamelCase__      :			Any=40_96, UpperCamelCase__      :			Union[str, Any]=16, UpperCamelCase__      :			Dict=12, UpperCamelCase__      :			Union[str, Any]=40_96, UpperCamelCase__      :			Any=16, UpperCamelCase__      :			Tuple=0.05, UpperCamelCase__      :			Dict=0.05, UpperCamelCase__      :			List[Any]=True, UpperCamelCase__      :			Union[str, Any]=True, UpperCamelCase__      :			List[Any]="relu", UpperCamelCase__      :			int=10_24, UpperCamelCase__      :			Any=0.1, UpperCamelCase__      :			Optional[Any]=0.1, UpperCamelCase__      :			Dict=0.0, UpperCamelCase__      :			List[Any]=0.02, UpperCamelCase__      :			str=2, UpperCamelCase__      :			Optional[int]=True, UpperCamelCase__      :			Optional[int]=False, UpperCamelCase__      :			int="float32", UpperCamelCase__      :			Optional[Any]=False, UpperCamelCase__      :			Dict=1_28, UpperCamelCase__      :			Optional[int]=64, UpperCamelCase__      :			Tuple=4, UpperCamelCase__      :			Any=4, UpperCamelCase__      :			Dict=0.001, UpperCamelCase__      :			List[str]=0.001, UpperCamelCase__      :			Union[str, Any]="all", UpperCamelCase__      :			Tuple=False, UpperCamelCase__      :			Dict=False, UpperCamelCase__      :			Any=1.0, UpperCamelCase__      :			Tuple=0.2, UpperCamelCase__      :			Optional[int]=1, UpperCamelCase__      :			int=0, UpperCamelCase__      :			List[str]=2, UpperCamelCase__      :			str=False, **UpperCamelCase__      :			Union[str, Any], )  ->			Tuple:
        _A    		=  vocab_size
        _A    		=  max_position_embeddings
        _A    		=  d_model
        _A    		=  encoder_ffn_dim
        _A    		=  encoder_layers
        _A    		=  encoder_attention_heads
        _A    		=  decoder_ffn_dim
        _A    		=  decoder_layers
        _A    		=  decoder_attention_heads
        _A    		=  dropout
        _A    		=  attention_dropout
        _A    		=  activation_dropout
        _A    		=  activation_function
        _A    		=  init_std
        _A    		=  encoder_layerdrop
        _A    		=  decoder_layerdrop
        _A    		=  use_cache
        _A    		=  encoder_layers
        _A    		=  scale_embedding  # scale factor will be sqrt(d_model) if True
        _A    		=  router_z_loss_coef
        _A    		=  router_aux_loss_coef
        _A    		=  decoder_sparse_step
        _A    		=  encoder_sparse_step
        _A    		=  num_experts
        _A    		=  expert_capacity
        _A    		=  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    		=  router_dtype

        _A    		=  router_ignore_padding_tokens
        _A    		=  batch_prioritized_routing
        _A    		=  second_expert_policy
        _A    		=  normalize_router_prob_before_dropping
        _A    		=  moe_eval_capacity_token_fraction
        _A    		=  moe_token_dropout
        _A    		=  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'''






import os
from pathlib import Path





def  _SCREAMING_SNAKE_CASE		(      ):
     from torch.utils.cpp_extension import load

     _A    		=  Path(__snake_case				).resolve().parent.parent.parent / 'kernels' / 'deformable_detr'
     _A    		=  [
         root / filename
         for filename in [
             'vision.cpp',
             os.path.join('cpu'   ,		'ms_deform_attn_cpu.cpp'				),
             os.path.join('cuda'   ,		'ms_deform_attn_cuda.cu'				),
         ]
     ]

     load(
         'MultiScaleDeformableAttention'   ,		__snake_case   ,		with_cuda=__snake_case   ,		extra_include_paths=[str(__snake_case				)]   ,		extra_cflags=['-DWITH_CUDA=1']   ,		extra_cuda_cflags=[
             '-DCUDA_HAS_FP16=1',
             '-D__CUDA_NO_HALF_OPERATORS__',
             '-D__CUDA_NO_HALF_CONVERSIONS__',
             '-D__CUDA_NO_HALF2_OPERATORS__',
         ]   ,		)

     import MultiScaleDeformableAttention as MSDA

     return MSDA



