



'''simple docstring'''







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


_UpperCamelCase  						=			logging.get_logger(__name__)

_UpperCamelCase  						=			{
    """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      lowerCamelCase__     (     _A				):






	'''simple docstring'''

	A__		=	'''vit-hybrid'''




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




								'''simple docstring'''





								super().__init__(**__A					)

								if backbone_config is None:
															logger.info("""`backbone_config` is `None`. Initializing the config with a `BiT` backbone."""					)
															lowerCAmelCase__  =   {
															    """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:
																						lowerCAmelCase__  =   CONFIG_MAPPING[backbone_config["""model_type"""]]
															else:
																						logger.info(
																						    """`model_type` is not found in `backbone_config`. Use `Bit` as the backbone configuration class."""					)
																						lowerCAmelCase__  =   BitConfig
															lowerCAmelCase__  =   backbone_config_class(**__A					)

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




	def      lowercase__							(  self		:  Optional[int]					)     ->			Dict[str, any]:




								'''simple docstring'''





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










'''simple docstring'''







from ..utils import DummyObject, requires_backends

class      lowerCamelCase__     (     metaclass=_A				):






	'''simple docstring'''

	A__		=	['''torch''', '''librosa''']




	def __init__(  self		:  Optional[Any]   ,		*__A		:  Tuple   ,		**__A		:  Tuple					)     ->			Union[str, Any]:




								'''simple docstring'''





								requires_backends(self   ,		["""torch""", """librosa"""]					)




	@classmethod
	def      lowercase__							(  cls		:  Dict   ,		*__A		:  List[Any]   ,		**__A		:  List[str]					)     ->			Union[str, Any]:




								'''simple docstring'''





								requires_backends(cls   ,		["""torch""", """librosa"""]					)




	@classmethod
	def      lowercase__							(  cls		:  Optional[int]   ,		*__A		:  List[str]   ,		**__A		:  Tuple					)     ->			Any:




								'''simple docstring'''





								requires_backends(cls   ,		["""torch""", """librosa"""]					)





class      lowerCamelCase__     (     metaclass=_A				):






	'''simple docstring'''

	A__		=	['''torch''', '''librosa''']




	def __init__(  self		:  int   ,		*__A		:  Dict   ,		**__A		:  List[Any]					)     ->			List[Any]:




								'''simple docstring'''





								requires_backends(self   ,		["""torch""", """librosa"""]					)




	@classmethod
	def      lowercase__							(  cls		:  Optional[int]   ,		*__A		:  Optional[int]   ,		**__A		:  List[Any]					)     ->			Union[str, Any]:




								'''simple docstring'''





								requires_backends(cls   ,		["""torch""", """librosa"""]					)




	@classmethod
	def      lowercase__							(  cls		:  List[str]   ,		*__A		:  List[str]   ,		**__A		:  int					)     ->			List[str]:




								'''simple docstring'''





								requires_backends(cls   ,		["""torch""", """librosa"""]					)





