




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

__a		     =   {
    '''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 				UpperCAmelCase(					snake_case_					):



	"""simple docstring"""






	a     : Tuple	  =					"""vit-hybrid"""

	def __init__(					self	,				lowerCamelCase=None	,				lowerCamelCase=768	,				lowerCamelCase=12	,				lowerCamelCase=12	,				lowerCamelCase=3072	,				lowerCamelCase="gelu"	,				lowerCamelCase=0.0	,				lowerCamelCase=0.0	,				lowerCamelCase=0.02	,				lowerCamelCase=1E-12	,				lowerCamelCase=224	,				lowerCamelCase=1	,				lowerCamelCase=3	,				lowerCamelCase=[1, 1024, 24, 24]	,				lowerCamelCase=True	,				**lowerCamelCase	,				) ->      Optional[int]:





								"""simple docstring"""


								super().__init__(**lowerCamelCase    )

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

								if isinstance(lowerCamelCase	,				lowerCamelCase    ):
															if "model_type" in backbone_config:
																						lowercase__  :	str        =							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__  :	int        =							BitConfig
															lowercase__  :	Tuple        =							backbone_config_class(**lowerCamelCase    )

								lowercase__  :	Any        =							backbone_featmap_shape
								lowercase__  :	Any        =							backbone_config
								lowercase__  :	Optional[Any]        =							hidden_size
								lowercase__  :	Optional[Any]        =							num_hidden_layers
								lowercase__  :	str        =							num_attention_heads
								lowercase__  :	Optional[int]        =							intermediate_size
								lowercase__  :	Dict        =							hidden_act
								lowercase__  :	Dict        =							hidden_dropout_prob
								lowercase__  :	Dict        =							attention_probs_dropout_prob
								lowercase__  :	Any        =							initializer_range
								lowercase__  :	int        =							layer_norm_eps
								lowercase__  :	str        =							image_size
								lowercase__  :	Optional[int]        =							patch_size
								lowercase__  :	Optional[Any]        =							num_channels
								lowercase__  :	List[str]        =							qkv_bias







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





								"""simple docstring"""


								lowercase__  :	Any        =							copy.deepcopy(self.__dict__    )
								lowercase__  :	Union[str, Any]        =							self.backbone_config.to_dict()
								lowercase__  :	Dict        =							self.__class__.model_type
								return output





def  snake_case_					(		SCREAMING_SNAKE_CASE_    )      ->			list:
							lowercase__  :	Optional[Any]        =							len(SCREAMING_SNAKE_CASE_    )

							# Set the gap value to be decreased by a factor of 1.3
							# after each iteration
							lowercase__  :	Tuple        =							1.3

							# Continue sorting until the gap is 1
							while gap > 1:
														# Decrease the gap value
														lowercase__  :	Tuple        =							int(gap / shrink    )

														# Sort the elements using insertion sort
														for i in range(SCREAMING_SNAKE_CASE_    ,len(SCREAMING_SNAKE_CASE_    )    ):
																					lowercase__  :	int        =							collection[i]
																					lowercase__  :	Union[str, Any]        =							i
																					while j >= gap and collection[j - gap] > temp:
																												lowercase__  :	str        =							collection[j - gap]
																												j -= gap
																					lowercase__  :	List[Any]        =							temp

							return collection


if __name__ == "__main__":
						import doctest

						doctest.testmod()