



'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


A_							:				str						=			{
    """configuration_align""": [
        """ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """AlignConfig""",
        """AlignTextConfig""",
        """AlignVisionConfig""",
    ],
    """processing_align""": ["""AlignProcessor"""],
}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A_							:				Tuple						=			[
       """ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST""",
       """AlignModel""",
       """AlignPreTrainedModel""",
       """AlignTextModel""",
       """AlignVisionModel""",
   ]

if TYPE_CHECKING:
   from .configuration_align import (
       ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP,
       AlignConfig,
       AlignTextConfig,
       AlignVisionConfig,
   )
   from .processing_align import AlignProcessor

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_align import (
          ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST,
          AlignModel,
          AlignPreTrainedModel,
          AlignTextModel,
          AlignVisionModel,
      )

else:
   import sys

   A_							:				List[Any]						=			_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)








'''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


A_							:				List[str]						=			logging.get_logger(__name__)

A_							:				Optional[int]						=			{
    """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 (						_lowerCamelCase       ):


 """simple docstring"""


 UpperCAmelCase					=						"""vit-hybrid"""







 def __init__(							self						,a_=None						,a_=768						,a_=12						,a_=12						,a_=3_072						,a_="gelu"						,a_=0.0						,a_=0.0						,a_=0.02						,a_=1E-1_2						,a_=224						,a_=1						,a_=3						,a_=[1, 1_024, 24, 24]						,a_=True						,**a_						,)	->     Union[str, Any]:
        super().__init__(**a_							)

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

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







 def _snake_case				(							self							)	->     Dict[str, any]:
        _UpperCAmelCase						:		Optional[Any]      =				copy.deepcopy(self.__dict__							)
        _UpperCAmelCase						:		Optional[Any]      =				self.backbone_config.to_dict()
        _UpperCAmelCase						:		Tuple      =				self.__class__.model_type
        return output



