

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     lowercase_       (    a_	):
      UpperCamelCase_     :						int		 =							"vit-hybrid"



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

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

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

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







      def 		UpperCamelCase_						(     self :							Dict						)       ->	Dict:
        _snake_case		=				copy.deepcopy(self.__dict__						)
        _snake_case		=				self.backbone_config.to_dict()
        _snake_case		=				self.__class__.model_type
        return output






def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round((float(_lowerCAmelCase) * 9 / 5) + 32 ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round(float(_lowerCAmelCase) + 273.15 ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round((float(_lowerCAmelCase) * 9 / 5) + 491.67 ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round((float(_lowerCAmelCase) - 32) * 5 / 9 ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round(((float(_lowerCAmelCase) - 32) * 5 / 9) + 273.15 ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round(float(_lowerCAmelCase) + 459.67 ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round(float(_lowerCAmelCase) - 273.15 ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round(((float(_lowerCAmelCase) - 273.15) * 9 / 5) + 32 ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round((float(_lowerCAmelCase) * 9 / 5) ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round((float(_lowerCAmelCase) - 491.67) * 5 / 9 ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round(float(_lowerCAmelCase) - 459.67 ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round((float(_lowerCAmelCase) * 5 / 9) ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round((float(_lowerCAmelCase) * 1.25 + 273.15) ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round((float(_lowerCAmelCase) * 2.25 + 32) ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round((float(_lowerCAmelCase) * 1.25) ,						_lowerCAmelCase)



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase = 2):
					return round((float(_lowerCAmelCase) * 2.25 + 32 + 459.67) ,						_lowerCAmelCase)


if __name__ == "__main__":
	import doctest

	doctest.testmod()
