



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


__magic_name__       =     logging.get_logger(__name__)

__magic_name__       =     {
    """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 	a__       (       __lowerCamelCase       ):


					"""simple docstring"""



					A__  :				Union[str, Any]					 =				'''vit-hybrid'''

					def __init__(		self     :Optional[int]      ,  lowercase__     :Dict=None      ,  lowercase__     :str=768      ,  lowercase__     :int=12      ,  lowercase__     :str=12      ,  lowercase__     :Union[str, Any]=3072      ,  lowercase__     :Optional[Any]="gelu"      ,  lowercase__     :Tuple=0.0      ,  lowercase__     :Tuple=0.0      ,  lowercase__     :List[str]=0.02      ,  lowercase__     :Tuple=1E-12      ,  lowercase__     :Tuple=224      ,  lowercase__     :Tuple=1      ,  lowercase__     :List[Any]=3      ,  lowercase__     :Dict=[1, 1024, 24, 24]      ,  lowercase__     :Any=True      ,  **lowercase__     :Optional[Any]      ,  ):
										super().__init__(**_lowercase    )

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

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

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



					def 				__UpperCAmelCase		(		self     :Optional[int]    ):
										lowercase						   =       copy.deepcopy(self.__dict__    )
										lowercase						   =       self.backbone_config.to_dict()
										lowercase						   =       self.__class__.model_type
										return output







"""simple docstring"""







from __future__ import annotations


def 	a__   (		UpperCAmelCase__							:      list      )->						int | float:
						UpperCAmelCase__       						=		sorted(UpperCAmelCase__      )
						UpperCAmelCase__       						=		len(UpperCAmelCase__      )
						UpperCAmelCase__       						=		length >> 1
						return (
						    (sorted_list[mid_index] + sorted_list[mid_index - 1]) / 2
						    if length % 2 == 0
						    else sorted_list[mid_index]
						)


def 	a__   (		)->						Dict:
						import doctest

						doctest.testmod()


if __name__ == "__main__":
						main()

