





"""simple docstring"""
import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..bit import BitConfig


lowerCamelCase_								=		logging.get_logger(__name__)

lowerCamelCase_								=		{
    "Intel/dpt-large": "https://huggingface.co/Intel/dpt-large/resolve/main/config.json",
    # See all DPT models at https://huggingface.co/models?filter=dpt
}






class 					_SCREAMING_SNAKE_CASE(   A  ):
       SCREAMING_SNAKE_CASE_   :      Tuple							=  '''dpt'''




       def __init__(						self		,SCREAMING_SNAKE_CASE__=7_68		,SCREAMING_SNAKE_CASE__=12		,SCREAMING_SNAKE_CASE__=12		,SCREAMING_SNAKE_CASE__=30_72		,SCREAMING_SNAKE_CASE__="gelu"		,SCREAMING_SNAKE_CASE__=0.0		,SCREAMING_SNAKE_CASE__=0.0		,SCREAMING_SNAKE_CASE__=0.0_2		,SCREAMING_SNAKE_CASE__=1E-12		,SCREAMING_SNAKE_CASE__=3_84		,SCREAMING_SNAKE_CASE__=16		,SCREAMING_SNAKE_CASE__=3		,SCREAMING_SNAKE_CASE__=False		,SCREAMING_SNAKE_CASE__=True		,SCREAMING_SNAKE_CASE__=[2, 5, 8, 11]		,SCREAMING_SNAKE_CASE__="project"		,SCREAMING_SNAKE_CASE__=[4, 2, 1, 0.5]		,SCREAMING_SNAKE_CASE__=[96, 1_92, 3_84, 7_68]		,SCREAMING_SNAKE_CASE__=2_56		,SCREAMING_SNAKE_CASE__=-1		,SCREAMING_SNAKE_CASE__=False		,SCREAMING_SNAKE_CASE__=True		,SCREAMING_SNAKE_CASE__=0.4		,SCREAMING_SNAKE_CASE__=2_55		,SCREAMING_SNAKE_CASE__=0.1		,SCREAMING_SNAKE_CASE__=[1, 10_24, 24, 24]		,SCREAMING_SNAKE_CASE__=[0, 1]		,SCREAMING_SNAKE_CASE__=None		,**SCREAMING_SNAKE_CASE__		,)			->      int:





             """simple docstring"""






             super().__init__(**SCREAMING_SNAKE_CASE__							)

             __SCREAMING_SNAKE_CASE   :List[Any]						=  hidden_size
             __SCREAMING_SNAKE_CASE   :List[str]						=  is_hybrid

             if self.is_hybrid:
                   if backbone_config is None:
                         logger.info('''Initializing the config with a `BiT` backbone.'''							)
                         __SCREAMING_SNAKE_CASE   :Dict						=  {
                             '''global_padding''': '''same''',
                             '''layer_type''': '''bottleneck''',
                             '''depths''': [3, 4, 9],
                             '''out_features''': ['''stage1''', '''stage2''', '''stage3'''],
                             '''embedding_dynamic_padding''': True,
                         }
                         __SCREAMING_SNAKE_CASE   :Any						=  BitConfig(**SCREAMING_SNAKE_CASE__							)
                   elif isinstance(SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							):
                         logger.info('''Initializing the config with a `BiT` backbone.'''							)
                         __SCREAMING_SNAKE_CASE   :int						=  BitConfig(**SCREAMING_SNAKE_CASE__							)
                   elif isinstance(SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							):
                         __SCREAMING_SNAKE_CASE   :Dict						=  backbone_config
                   else:
                         raise ValueError(
                             f'''backbone_config must be a dictionary or a `PretrainedConfig`, got {backbone_config.__class__}.'''							)

                   __SCREAMING_SNAKE_CASE   :List[str]						=  backbone_featmap_shape
                   __SCREAMING_SNAKE_CASE   :List[str]						=  neck_ignore_stages

                   if readout_type != "project":
                         raise ValueError('''Readout type must be \'project\' when using `DPT-hybrid` mode.'''							)
             else:
                   __SCREAMING_SNAKE_CASE   :List[Any]						=  None
                   __SCREAMING_SNAKE_CASE   :int						=  None
                   __SCREAMING_SNAKE_CASE   :Optional[Any]						=  []

             __SCREAMING_SNAKE_CASE   :int						=  num_hidden_layers
             __SCREAMING_SNAKE_CASE   :Optional[int]						=  num_attention_heads
             __SCREAMING_SNAKE_CASE   :Optional[Any]						=  intermediate_size
             __SCREAMING_SNAKE_CASE   :Dict						=  hidden_act
             __SCREAMING_SNAKE_CASE   :Optional[Any]						=  hidden_dropout_prob
             __SCREAMING_SNAKE_CASE   :int						=  attention_probs_dropout_prob
             __SCREAMING_SNAKE_CASE   :Optional[int]						=  initializer_range
             __SCREAMING_SNAKE_CASE   :Any						=  layer_norm_eps
             __SCREAMING_SNAKE_CASE   :List[Any]						=  image_size
             __SCREAMING_SNAKE_CASE   :Optional[Any]						=  patch_size
             __SCREAMING_SNAKE_CASE   :Tuple						=  num_channels
             __SCREAMING_SNAKE_CASE   :Optional[Any]						=  qkv_bias
             __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  backbone_out_indices
             if readout_type not in ["ignore", "add", "project"]:
                   raise ValueError('''Readout_type must be one of [\'ignore\', \'add\', \'project\']'''							)
             __SCREAMING_SNAKE_CASE   :int						=  readout_type
             __SCREAMING_SNAKE_CASE   :str						=  reassemble_factors
             __SCREAMING_SNAKE_CASE   :List[Any]						=  neck_hidden_sizes
             __SCREAMING_SNAKE_CASE   :Dict						=  fusion_hidden_size
             __SCREAMING_SNAKE_CASE   :Optional[Any]						=  head_in_index
             __SCREAMING_SNAKE_CASE   :Any						=  use_batch_norm_in_fusion_residual
             # auxiliary head attributes (semantic segmentation)
             __SCREAMING_SNAKE_CASE   :int						=  use_auxiliary_head
             __SCREAMING_SNAKE_CASE   :int						=  auxiliary_loss_weight
             __SCREAMING_SNAKE_CASE   :str						=  semantic_loss_ignore_index
             __SCREAMING_SNAKE_CASE   :Any						=  semantic_classifier_dropout




       def     _UpperCamelCase     (						self							)			->      List[Any]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE   :str						=  copy.deepcopy(self.__dict__							)

             if output["backbone_config"] is not None:
                   __SCREAMING_SNAKE_CASE   :Optional[int]						=  self.backbone_config.to_dict()

             __SCREAMING_SNAKE_CASE   :Optional[Any]						=  self.__class__.model_type
             return output






"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCamelCase_								=		{
    "configuration_blip_2": [
        "BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "Blip2Config",
        "Blip2QFormerConfig",
        "Blip2VisionConfig",
    ],
    "processing_blip_2": ["Blip2Processor"],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowerCamelCase_								=		[
      "BLIP_2_PRETRAINED_MODEL_ARCHIVE_LIST",
      "Blip2Model",
      "Blip2QFormerModel",
      "Blip2PreTrainedModel",
      "Blip2ForConditionalGeneration",
      "Blip2VisionModel",
  ]

if TYPE_CHECKING:
  from .configuration_blip_a import (
      BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP,
      BlipaConfig,
      BlipaQFormerConfig,
      BlipaVisionConfig,
  )
  from .processing_blip_a import BlipaProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_blip_a import (
        BLIP_2_PRETRAINED_MODEL_ARCHIVE_LIST,
        BlipaForConditionalGeneration,
        BlipaModel,
        BlipaPreTrainedModel,
        BlipaQFormerModel,
        BlipaVisionModel,
    )

else:
  import sys

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