from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


__lowerCamelCase    :				str							     =	logging.get_logger(__name__)

__lowerCamelCase    :				Any							     =	{
    '''facebook/levit-128S''': '''https://huggingface.co/facebook/levit-128S/resolve/main/config.json''',
    # See all LeViT models at https://huggingface.co/models?filter=levit
}







class __snake_case       (		UpperCAmelCase_	):
			lowerCAmelCase_														=							"levit"




			def __init__(					self    :       int ,			_lowercase    :       Optional[Any]=2_24 ,			_lowercase    :       Tuple=3 ,			_lowercase    :       Optional[int]=3 ,			_lowercase    :       str=2 ,			_lowercase    :       Union[str, Any]=1 ,			_lowercase    :       Any=16 ,			_lowercase    :       List[str]=[1_28, 2_56, 3_84] ,			_lowercase    :       Tuple=[4, 8, 12] ,			_lowercase    :       Dict=[4, 4, 4] ,			_lowercase    :       Optional[int]=[16, 16, 16] ,			_lowercase    :       List[Any]=0 ,			_lowercase    :       str=[2, 2, 2] ,			_lowercase    :       Optional[Any]=[2, 2, 2] ,			_lowercase    :       Dict=0.02 ,			**_lowercase    :       Union[str, Any] ,			):



					"""simple docstring"""






					super().__init__(**_snake_case   )
					SCREAMING_SNAKE_CASE__    							=   image_size
					SCREAMING_SNAKE_CASE__    							=   num_channels
					SCREAMING_SNAKE_CASE__    							=   kernel_size
					SCREAMING_SNAKE_CASE__    							=   stride
					SCREAMING_SNAKE_CASE__    							=   padding
					SCREAMING_SNAKE_CASE__    							=   hidden_sizes
					SCREAMING_SNAKE_CASE__    							=   num_attention_heads
					SCREAMING_SNAKE_CASE__    							=   depths
					SCREAMING_SNAKE_CASE__    							=   key_dim
					SCREAMING_SNAKE_CASE__    							=   drop_path_rate
					SCREAMING_SNAKE_CASE__    							=   patch_size
					SCREAMING_SNAKE_CASE__    							=   attention_ratio
					SCREAMING_SNAKE_CASE__    							=   mlp_ratio
					SCREAMING_SNAKE_CASE__    							=   initializer_range
					SCREAMING_SNAKE_CASE__    							=   [
					    ["""Subsample""", key_dim[0], hidden_sizes[0] // key_dim[0], 4, 2, 2],
					    ["""Subsample""", key_dim[0], hidden_sizes[1] // key_dim[0], 4, 2, 2],
					]







class __snake_case       (		UpperCAmelCase_	):
			lowerCAmelCase_														=							version.parse("1.11"	)




			@property
			def 			__a		(					self    :       Union[str, Any]   ):



					"""simple docstring"""






					return OrderedDict(
					    [
					        ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
					    ]   )




			@property
			def 			__a		(					self    :       List[Any]   ):



					"""simple docstring"""






					return 1E-4

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


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

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







class __snake_case       (		lowerCamelCase_	):
   lowerCAmelCase_														=							"nllb-moe"
   lowerCAmelCase_														=							["past_key_values"]
   lowerCAmelCase_														=							{"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}




   def __init__(					self    :       int ,			_lowercase    :       Tuple=12_81_12 ,			_lowercase    :       List[Any]=10_24 ,			_lowercase    :       Any=12 ,			_lowercase    :       List[Any]=40_96 ,			_lowercase    :       str=16 ,			_lowercase    :       str=12 ,			_lowercase    :       Optional[int]=40_96 ,			_lowercase    :       List[Any]=16 ,			_lowercase    :       str=0.05 ,			_lowercase    :       Tuple=0.05 ,			_lowercase    :       str=True ,			_lowercase    :       List[str]=True ,			_lowercase    :       Optional[Any]="relu" ,			_lowercase    :       str=10_24 ,			_lowercase    :       Tuple=0.1 ,			_lowercase    :       int=0.1 ,			_lowercase    :       Dict=0.0 ,			_lowercase    :       List[str]=0.02 ,			_lowercase    :       int=2 ,			_lowercase    :       Optional[Any]=True ,			_lowercase    :       List[Any]=False ,			_lowercase    :       List[str]="float32" ,			_lowercase    :       Optional[Any]=False ,			_lowercase    :       str=1_28 ,			_lowercase    :       int=64 ,			_lowercase    :       Optional[int]=4 ,			_lowercase    :       List[str]=4 ,			_lowercase    :       Union[str, Any]=0.0_01 ,			_lowercase    :       List[Any]=0.0_01 ,			_lowercase    :       List[str]="all" ,			_lowercase    :       Optional[Any]=False ,			_lowercase    :       int=False ,			_lowercase    :       Tuple=1.0 ,			_lowercase    :       Optional[int]=0.2 ,			_lowercase    :       Optional[int]=1 ,			_lowercase    :       List[Any]=0 ,			_lowercase    :       List[Any]=2 ,			_lowercase    :       int=False ,			**_lowercase    :       Union[str, Any] ,			):



     """simple docstring"""






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

     SCREAMING_SNAKE_CASE__    							=   router_ignore_padding_tokens
     SCREAMING_SNAKE_CASE__    							=   batch_prioritized_routing
     SCREAMING_SNAKE_CASE__    							=   second_expert_policy
     SCREAMING_SNAKE_CASE__    							=   normalize_router_prob_before_dropping
     SCREAMING_SNAKE_CASE__    							=   moe_eval_capacity_token_fraction
     SCREAMING_SNAKE_CASE__    							=   moe_token_dropout
     SCREAMING_SNAKE_CASE__    							=   output_router_logits
     super().__init__(
         pad_token_id=_lowercase ,			bos_token_id=_lowercase ,			eos_token_id=_lowercase ,			is_encoder_decoder=_lowercase ,			decoder_start_token_id=_lowercase ,			**_lowercase ,			)
