



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

UpperCamelCase__    :     List[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 							_lowerCAmelCase	(  __A							):


 """simple docstring"""

 lowerCamelCase									=     '''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					,    )    ->    Tuple:
    super().__init__(**_lowerCamelCase  )

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

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







 def       UpperCAmelCase_       (      self  )    ->    Dict[str, any]:
    A_  :		Dict						=					copy.deepcopy(self.__dict__  )
    A_  :		Union[str, Any]						=					self.backbone_config.to_dict()
    A_  :		List[str]						=					self.__class__.model_type
    return output





'''simple docstring'''





from ..utils import DummyObject, requires_backends


class 							_lowerCAmelCase	(  metaclass=__A							):


 """simple docstring"""

 lowerCamelCase									=     ['''torch''', '''librosa''']







 def __init__(      self					,    *_lowerCamelCase					,    **_lowerCamelCase  )    ->    str:
    requires_backends(self					,    ["""torch""", """librosa"""]  )







 @classmethod
 def       UpperCAmelCase_       (      cls					,    *_lowerCamelCase					,    **_lowerCamelCase  )    ->    Dict:
    requires_backends(cls					,    ["""torch""", """librosa"""]  )







 @classmethod
 def       UpperCAmelCase_       (      cls					,    *_lowerCamelCase					,    **_lowerCamelCase  )    ->    Optional[int]:
    requires_backends(cls					,    ["""torch""", """librosa"""]  )


class 							_lowerCAmelCase	(  metaclass=__A							):


 """simple docstring"""

 lowerCamelCase									=     ['''torch''', '''librosa''']







 def __init__(      self					,    *_lowerCamelCase					,    **_lowerCamelCase  )    ->    Dict:
    requires_backends(self					,    ["""torch""", """librosa"""]  )







 @classmethod
 def       UpperCAmelCase_       (      cls					,    *_lowerCamelCase					,    **_lowerCamelCase  )    ->    str:
    requires_backends(cls					,    ["""torch""", """librosa"""]  )







 @classmethod
 def       UpperCAmelCase_       (      cls					,    *_lowerCamelCase					,    **_lowerCamelCase  )    ->    Dict:
    requires_backends(cls					,    ["""torch""", """librosa"""]  )
