



"""simple docstring"""


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

__A   :							Dict										=   {
    "google/vit-base-patch16-224": "https://huggingface.co/vit-base-patch16-224/resolve/main/config.json",
    # See all ViT models at https://huggingface.co/models?filter=vit
}
class 			_a (					lowerCAmelCase):
			"""simple docstring"""
			UpperCamelCase__			      =	"""vit"""



			def __init__(		self     :    int				,   __UpperCamelCase     :    str=7_6_8				,   __UpperCamelCase     :    Dict=1_2				,   __UpperCamelCase     :    List[str]=1_2				,   __UpperCamelCase     :    List[Any]=3_0_7_2				,   __UpperCamelCase     :    int="gelu"				,   __UpperCamelCase     :    int=0.0				,   __UpperCamelCase     :    Union[str, Any]=0.0				,   __UpperCamelCase     :    List[Any]=0.0_2				,   __UpperCamelCase     :    int=1e-12				,   __UpperCamelCase     :    Optional[int]=2_2_4				,   __UpperCamelCase     :    str=1_6				,   __UpperCamelCase     :    str=3				,   __UpperCamelCase     :    Union[str, Any]=True				,   __UpperCamelCase     :    Any=1_6				,   **__UpperCamelCase     :    List[Any]				,   )->List[str]:
							super().__init__(**__UpperCamelCase   )

							_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					=    qkv_bias
							_UpperCAmelCase					=    encoder_stride



class 			_a (					lowerCAmelCase):
			"""simple docstring"""
			UpperCamelCase__			      =	version.parse("""1.11""")



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



			@property
			def  lowercase__						(		self     :    Optional[Any]   )->float:
							return 1e-4








"""simple docstring"""


from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


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

__A   :							Optional[Any]										=   {
    "google/bit-50": "https://huggingface.co/google/bit-50/resolve/main/config.json",
}
class 			_a (					lowerCAmelCase			,							lowerCAmelCase):
			"""simple docstring"""
			UpperCamelCase__			      =	"""bit"""
			UpperCamelCase__			      =	["""preactivation""", """bottleneck"""]
			UpperCamelCase__			      =	["""SAME""", """VALID"""]



			def __init__(		self     :    List[Any]				,   __UpperCamelCase     :    Optional[int]=3				,   __UpperCamelCase     :    Optional[int]=6_4				,   __UpperCamelCase     :    List[Any]=[2_5_6, 5_1_2, 1_0_2_4, 2_0_4_8]				,   __UpperCamelCase     :    Any=[3, 4, 6, 3]				,   __UpperCamelCase     :    str="preactivation"				,   __UpperCamelCase     :    Union[str, Any]="relu"				,   __UpperCamelCase     :    str=None				,   __UpperCamelCase     :    Dict=3_2				,   __UpperCamelCase     :    List[str]=0.0				,   __UpperCamelCase     :    Any=False				,   __UpperCamelCase     :    Union[str, Any]=3_2				,   __UpperCamelCase     :    List[str]=1				,   __UpperCamelCase     :    List[str]=None				,   __UpperCamelCase     :    Optional[Any]=None				,   **__UpperCamelCase     :    List[str]				,   )->List[Any]:
							super().__init__(**__UpperCamelCase   )
							if layer_type not in self.layer_types:
											raise ValueError(F'layer_type={layer_type} is not one of {",".join(self.layer_types   )}'   )
							if global_padding is not None:
											if global_padding.upper() in self.supported_padding:
															_UpperCAmelCase					=    global_padding.upper()
											else:
															raise ValueError(F'Padding strategy {global_padding} not supported'   )
							_UpperCAmelCase					=    num_channels
							_UpperCAmelCase					=    embedding_size
							_UpperCAmelCase					=    hidden_sizes
							_UpperCAmelCase					=    depths
							_UpperCAmelCase					=    layer_type
							_UpperCAmelCase					=    hidden_act
							_UpperCAmelCase					=    global_padding
							_UpperCAmelCase					=    num_groups
							_UpperCAmelCase					=    drop_path_rate
							_UpperCAmelCase					=    embedding_dynamic_padding
							_UpperCAmelCase					=    output_stride
							_UpperCAmelCase					=    width_factor

							_UpperCAmelCase					=    ['''stem'''] + [F'stage{idx}' for idx in range(1				,   len(__UpperCamelCase   ) + 1   )]
							_UpperCAmelCase		,						_UpperCAmelCase					=    get_aligned_output_features_output_indices(
							    out_features=__UpperCamelCase				,   out_indices=__UpperCamelCase				,   stage_names=self.stage_names   )



