




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    :				str    						=	logging.get_logger(__name__)

__A    :				Union[str, Any]    						=	{
    'apple/mobilevitv2-1.0': 'https://huggingface.co/apple/mobilevitv2-1.0/resolve/main/config.json',
}




class       UpperCAmelCase_   ( SCREAMING_SNAKE_CASE__							):




							'''simple docstring'''



							a__    	=  '''mobilevitv2'''





							def __init__(       self							:						Dict							,  a							:						Optional[Any]=3							,  a							:						Optional[int]=256							,  a							:						List[Any]=2							,  a							:						Dict=2.0							,  a							:						List[str]="swish"							,  a							:						Any=3							,  a							:						Optional[Any]=32							,  a							:						str=0.1							,  a							:						Any=0.02							,  a							:						str=1E-5							,  a							:						str=512							,  a							:						List[Any]=[6, 12, 18]							,  a							:						Optional[int]=0.1							,  a							:						int=255							,  a							:						str=[2, 4, 3]							,  a							:						Dict=[128, 192, 256]							,  a							:						str=1.0							,  a							:						Union[str, Any]=2							,  a							:						Tuple=0.0							,  a							:						List[str]=0.0							,  **a							:						int							,  )      ->       Any:
										super().__init__(**a      )

										SCREAMING_SNAKE_CASE     =       num_channels
										SCREAMING_SNAKE_CASE     =       image_size
										SCREAMING_SNAKE_CASE     =       patch_size
										SCREAMING_SNAKE_CASE     =       expand_ratio
										SCREAMING_SNAKE_CASE     =       hidden_act
										SCREAMING_SNAKE_CASE     =       conv_kernel_size
										SCREAMING_SNAKE_CASE     =       output_stride
										SCREAMING_SNAKE_CASE     =       initializer_range
										SCREAMING_SNAKE_CASE     =       layer_norm_eps
										SCREAMING_SNAKE_CASE     =       n_attn_blocks
										SCREAMING_SNAKE_CASE     =       base_attn_unit_dims
										SCREAMING_SNAKE_CASE     =       width_multiplier
										SCREAMING_SNAKE_CASE     =       ffn_multiplier
										SCREAMING_SNAKE_CASE     =       ffn_dropout
										SCREAMING_SNAKE_CASE     =       attn_dropout
										SCREAMING_SNAKE_CASE     =       classifier_dropout_prob

										# decode head attributes for semantic segmentation
										SCREAMING_SNAKE_CASE     =       aspp_out_channels
										SCREAMING_SNAKE_CASE     =       atrous_rates
										SCREAMING_SNAKE_CASE     =       aspp_dropout_prob
										SCREAMING_SNAKE_CASE     =       semantic_loss_ignore_index





class       UpperCAmelCase_   ( SCREAMING_SNAKE_CASE__							):




							'''simple docstring'''



							a__    	=  version.parse('''1.11'''							)





							@property
							def  _UpperCAmelCase  (       self							:						Union[str, Any]      )      ->       Mapping[str, Mapping[int, str]]:
										return OrderedDict([("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""})]      )





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







										if self.task == "image-classification":
													return OrderedDict([("""logits""", {0: """batch"""})]      )
										else:
													return OrderedDict([("""last_hidden_state""", {0: """batch"""}), ("""pooler_output""", {0: """batch"""})]      )







							@property
							def  _UpperCAmelCase  (       self							:						List[str]      )      ->       float:
										return 1E-4













import copy
from typing import Dict

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import CONFIG_MAPPING
from ..bit import BitConfig


a_    :				Union[str, Any]					=			logging.get_logger(__name__)

a_    :				Optional[Any]					=			{
    'google/vit-hybrid-base-bit-384': 'https://huggingface.co/vit-hybrid-base-bit-384/resolve/main/config.json',
    # See all ViT hybrid models at https://huggingface.co/models?filter=vit
}



class  SCREAMING_SNAKE_CASE_  ( SCREAMING_SNAKE_CASE__			):


  """simple docstring"""





  _a								=							"""vit-hybrid"""





  def __init__(  self	,  A=None	,  A=7_68	,  A=12	,  A=12	,  A=30_72	,  A="gelu"	,  A=0.0	,  A=0.0	,  A=0.02	,  A=1E-12	,  A=2_24	,  A=1	,  A=3	,  A=[1, 10_24, 24, 24]	,  A=True	,  **A	,  )		->   Union[str, Any]:





       '''simple docstring'''







       super().__init__(**A						)

       if backbone_config is None:
            logger.info('''`backbone_config` is `None`. Initializing the config with a `BiT` backbone.'''						)
            __magic_name__				=       {
                '''global_padding''': '''same''',
                '''layer_type''': '''bottleneck''',
                '''depths''': [3, 4, 9],
                '''out_features''': ['''stage3'''],
                '''embedding_dynamic_padding''': True,
            }

       if isinstance(A	,  A						):
            if "model_type" in backbone_config:
                 __magic_name__				=       CONFIG_MAPPING[backbone_config['''model_type''']]
            else:
                 logger.info(
                     '''`model_type` is not found in `backbone_config`. Use `Bit` as the backbone configuration class.'''						)
                 __magic_name__				=       BitConfig
            __magic_name__				=       backbone_config_class(**A						)

       __magic_name__				=       backbone_featmap_shape
       __magic_name__				=       backbone_config
       __magic_name__				=       hidden_size
       __magic_name__				=       num_hidden_layers
       __magic_name__				=       num_attention_heads
       __magic_name__				=       intermediate_size
       __magic_name__				=       hidden_act
       __magic_name__				=       hidden_dropout_prob
       __magic_name__				=       attention_probs_dropout_prob
       __magic_name__				=       initializer_range
       __magic_name__				=       layer_norm_eps
       __magic_name__				=       image_size
       __magic_name__				=       patch_size
       __magic_name__				=       num_channels
       __magic_name__				=       qkv_bias







  def 			__A      (  self						)		->   Dict[str, any]:





       '''simple docstring'''







       __magic_name__				=       copy.deepcopy(self.__dict__						)
       __magic_name__				=       self.backbone_config.to_dict()
       __magic_name__				=       self.__class__.model_type
       return output