






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 	lowercase_      (			lowercase     ):






      '''simple docstring'''




      __snake_case  						=						'''vit-hybrid'''







      def __init__(   self   :		List[str]				,      __UpperCAmelCase   :		Any=None				,      __UpperCAmelCase   :		Optional[int]=768				,      __UpperCAmelCase   :		Optional[Any]=12				,      __UpperCAmelCase   :		Any=12				,      __UpperCAmelCase   :		str=3_072				,      __UpperCAmelCase   :		str="gelu"				,      __UpperCAmelCase   :		Optional[Any]=0.0				,      __UpperCAmelCase   :		Optional[Any]=0.0				,      __UpperCAmelCase   :		Union[str, Any]=0.02				,      __UpperCAmelCase   :		Union[str, Any]=1e-1_2				,      __UpperCAmelCase   :		Union[str, Any]=224				,      __UpperCAmelCase   :		Any=1				,      __UpperCAmelCase   :		Union[str, Any]=3				,      __UpperCAmelCase   :		Optional[Any]=[1, 1_024, 24, 24]				,      __UpperCAmelCase   :		Optional[int]=True				,      **__UpperCAmelCase   :		List[str]				,      )					->Optional[Any]:




       """simple docstring"""


       super().__init__(**__UpperCAmelCase						)

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

       if isinstance(__UpperCAmelCase				,      __UpperCAmelCase						):
        if "model_type" in backbone_config:
         a							=   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							=   BitConfig
        a							=   backbone_config_class(**__UpperCAmelCase						)

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







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




       """simple docstring"""


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










from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCAmelCase__            =	{"configuration_visual_bert": ["VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "VisualBertConfig"]}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     UpperCAmelCase__            =	[
         "VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST",
         "VisualBertForMultipleChoice",
         "VisualBertForPreTraining",
         "VisualBertForQuestionAnswering",
         "VisualBertForRegionToPhraseAlignment",
         "VisualBertForVisualReasoning",
         "VisualBertLayer",
         "VisualBertModel",
         "VisualBertPreTrainedModel",
     ]


if TYPE_CHECKING:
     from .configuration_visual_bert import VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, VisualBertConfig

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_visual_bert import (
              VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
              VisualBertForMultipleChoice,
              VisualBertForPreTraining,
              VisualBertForQuestionAnswering,
              VisualBertForRegionToPhraseAlignment,
              VisualBertForVisualReasoning,
              VisualBertLayer,
              VisualBertModel,
              VisualBertPreTrainedModel,
          )


else:
     import sys

     UpperCAmelCase__            =	_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


