


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


__a     =			logging.get_logger(__name__)

__a     =			{
    """facebook/data2vec-vision-base-ft""": (
        """https://huggingface.co/facebook/data2vec-vision-base-ft/resolve/main/config.json"""
    ),
}






class   __lowercase				(  __snake_case  ):
      UpperCamelCase								=       '''data2vec-vision'''





      def __init__(		self						:					Tuple					,       __lowerCamelCase						:					Optional[Any]=7_6_8					,       __lowerCamelCase						:					Union[str, Any]=1_2					,       __lowerCamelCase						:					int=1_2					,       __lowerCamelCase						:					Optional[Any]=3_0_7_2					,       __lowerCamelCase						:					Optional[Any]="gelu"					,       __lowerCamelCase						:					Any=0.0					,       __lowerCamelCase						:					str=0.0					,       __lowerCamelCase						:					str=0.02					,       __lowerCamelCase						:					Any=1e-1_2					,       __lowerCamelCase						:					List[Any]=2_2_4					,       __lowerCamelCase						:					Union[str, Any]=1_6					,       __lowerCamelCase						:					List[Any]=3					,       __lowerCamelCase						:					List[Any]=False					,       __lowerCamelCase						:					Optional[int]=False					,       __lowerCamelCase						:					Optional[Any]=False					,       __lowerCamelCase						:					Optional[int]=False					,       __lowerCamelCase						:					Tuple=0.1					,       __lowerCamelCase						:					int=0.1					,       __lowerCamelCase						:					Tuple=True					,       __lowerCamelCase						:					Dict=[3, 5, 7, 1_1]					,       __lowerCamelCase						:					Union[str, Any]=[1, 2, 3, 6]					,       __lowerCamelCase						:					Any=True					,       __lowerCamelCase						:					str=0.4					,       __lowerCamelCase						:					Tuple=2_5_6					,       __lowerCamelCase						:					Dict=1					,       __lowerCamelCase						:					Optional[Any]=False					,       __lowerCamelCase						:					List[Any]=2_5_5					,       **__lowerCamelCase						:					Dict					,       )    ->   Dict:






         """simple docstring"""







         super().__init__(**__lowerCamelCase       )

         UpperCAmelCase							=     hidden_size
         UpperCAmelCase							=     num_hidden_layers
         UpperCAmelCase							=     num_attention_heads
         UpperCAmelCase							=     intermediate_size
         UpperCAmelCase							=     hidden_act
         UpperCAmelCase							=     hidden_dropout_prob
         UpperCAmelCase							=     attention_probs_dropout_prob
         UpperCAmelCase							=     initializer_range
         UpperCAmelCase							=     layer_norm_eps

         UpperCAmelCase							=     image_size
         UpperCAmelCase							=     patch_size
         UpperCAmelCase							=     num_channels
         UpperCAmelCase							=     use_mask_token
         UpperCAmelCase							=     use_absolute_position_embeddings
         UpperCAmelCase							=     use_relative_position_bias
         UpperCAmelCase							=     use_shared_relative_position_bias
         UpperCAmelCase							=     layer_scale_init_value
         UpperCAmelCase							=     drop_path_rate
         UpperCAmelCase							=     use_mean_pooling
         # decode head attributes (semantic segmentation)
         UpperCAmelCase							=     out_indices
         UpperCAmelCase							=     pool_scales
         # auxiliary head attributes (semantic segmentation)
         UpperCAmelCase							=     use_auxiliary_head
         UpperCAmelCase							=     auxiliary_loss_weight
         UpperCAmelCase							=     auxiliary_channels
         UpperCAmelCase							=     auxiliary_num_convs
         UpperCAmelCase							=     auxiliary_concat_input
         UpperCAmelCase							=     semantic_loss_ignore_index






class   __lowercase				(  __snake_case  ):
      UpperCamelCase								=       version.parse('''1.11'''  )





      @property
      def        _lowercase				(		self						:					str       )    ->   Mapping[str, Mapping[int, str]]:






         """simple docstring"""







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





      @property
      def        _lowercase				(		self						:					List[Any]       )    ->   float:






         """simple docstring"""







         return 1e-4







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   __lowercase				(  __snake_case  ):
      UpperCamelCase								=       '''nllb-moe'''
      UpperCamelCase								=       ['''past_key_values''']
      UpperCamelCase								=       {'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}





      def __init__(		self						:					Optional[int]					,       __lowerCamelCase						:					Optional[Any]=1_2_8_1_1_2					,       __lowerCamelCase						:					Dict=1_0_2_4					,       __lowerCamelCase						:					Optional[int]=1_2					,       __lowerCamelCase						:					Union[str, Any]=4_0_9_6					,       __lowerCamelCase						:					List[str]=1_6					,       __lowerCamelCase						:					List[str]=1_2					,       __lowerCamelCase						:					int=4_0_9_6					,       __lowerCamelCase						:					Tuple=1_6					,       __lowerCamelCase						:					str=0.05					,       __lowerCamelCase						:					List[str]=0.05					,       __lowerCamelCase						:					List[Any]=True					,       __lowerCamelCase						:					Tuple=True					,       __lowerCamelCase						:					str="relu"					,       __lowerCamelCase						:					Dict=1_0_2_4					,       __lowerCamelCase						:					List[str]=0.1					,       __lowerCamelCase						:					Optional[int]=0.1					,       __lowerCamelCase						:					List[Any]=0.0					,       __lowerCamelCase						:					Optional[Any]=0.02					,       __lowerCamelCase						:					Dict=2					,       __lowerCamelCase						:					Union[str, Any]=True					,       __lowerCamelCase						:					Any=False					,       __lowerCamelCase						:					Tuple="float32"					,       __lowerCamelCase						:					Any=False					,       __lowerCamelCase						:					Optional[int]=1_2_8					,       __lowerCamelCase						:					List[str]=6_4					,       __lowerCamelCase						:					List[Any]=4					,       __lowerCamelCase						:					Tuple=4					,       __lowerCamelCase						:					str=0.001					,       __lowerCamelCase						:					Optional[int]=0.001					,       __lowerCamelCase						:					Tuple="all"					,       __lowerCamelCase						:					Any=False					,       __lowerCamelCase						:					Optional[int]=False					,       __lowerCamelCase						:					List[str]=1.0					,       __lowerCamelCase						:					Dict=0.2					,       __lowerCamelCase						:					Union[str, Any]=1					,       __lowerCamelCase						:					int=0					,       __lowerCamelCase						:					Dict=2					,       __lowerCamelCase						:					int=False					,       **__lowerCamelCase						:					str					,       )    ->   int:






         """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=__lowerCamelCase					,       bos_token_id=__lowerCamelCase					,       eos_token_id=__lowerCamelCase					,       is_encoder_decoder=__lowerCamelCase					,       decoder_start_token_id=__lowerCamelCase					,       **__lowerCamelCase					,       )



