import copy

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


a_							=      logging.get_logger(__name__)

a_							=      {
    """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 			UpperCAmelCase__    (		snake_case					):



  """simple docstring"""






  lowerCAmelCase__		:	List[Any]    		= 'dpt'






  def __init__(				self:			Optional[int]				,				__lowerCAmelCase:			Any=768				,				__lowerCAmelCase:			Optional[int]=12				,				__lowerCAmelCase:			str=12				,				__lowerCAmelCase:			Optional[Any]=3_072				,				__lowerCAmelCase:			Union[str, Any]="gelu"				,				__lowerCAmelCase:			Any=0.0				,				__lowerCAmelCase:			Dict=0.0				,				__lowerCAmelCase:			str=0.02				,				__lowerCAmelCase:			Dict=1E-12				,				__lowerCAmelCase:			List[str]=384				,				__lowerCAmelCase:			Optional[int]=16				,				__lowerCAmelCase:			Any=3				,				__lowerCAmelCase:			List[Any]=False				,				__lowerCAmelCase:			str=True				,				__lowerCAmelCase:			List[str]=[2, 5, 8, 11]				,				__lowerCAmelCase:			str="project"				,				__lowerCAmelCase:			List[str]=[4, 2, 1, 0.5]				,				__lowerCAmelCase:			Union[str, Any]=[96, 192, 384, 768]				,				__lowerCAmelCase:			int=256				,				__lowerCAmelCase:			Union[str, Any]=-1				,				__lowerCAmelCase:			Tuple=False				,				__lowerCAmelCase:			str=True				,				__lowerCAmelCase:			str=0.4				,				__lowerCAmelCase:			List[str]=255				,				__lowerCAmelCase:			Tuple=0.1				,				__lowerCAmelCase:			List[str]=[1, 1_024, 24, 24]				,				__lowerCAmelCase:			Union[str, Any]=[0, 1]				,				__lowerCAmelCase:			List[str]=None				,				**__lowerCAmelCase:			Any				,				) -> Union[str, Any]:




    '''simple docstring'''




    super().__init__(**__lowerCAmelCase   )

    __UpperCAmelCase						    =       hidden_size
    __UpperCAmelCase						    =       is_hybrid

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

      __UpperCAmelCase						    =       backbone_featmap_shape
      __UpperCAmelCase						    =       neck_ignore_stages

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

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






  def 	_UpperCAmelCase				(				self:			List[str]   ) -> Union[str, Any]:




    '''simple docstring'''




    __UpperCAmelCase						    =       copy.deepcopy(self.__dict__   )

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

    __UpperCAmelCase						    =       self.__class__.model_type
    return output




from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


a_							=      {
    """configuration_altclip""": [
        """ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """AltCLIPConfig""",
        """AltCLIPTextConfig""",
        """AltCLIPVisionConfig""",
    ],
    """processing_altclip""": ["""AltCLIPProcessor"""],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a_							=      [
           """ALTCLIP_PRETRAINED_MODEL_ARCHIVE_LIST""",
           """AltCLIPPreTrainedModel""",
           """AltCLIPModel""",
           """AltCLIPTextModel""",
           """AltCLIPVisionModel""",
       ]


if TYPE_CHECKING:
       from .configuration_altclip import (
           ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
           AltCLIPConfig,
           AltCLIPTextConfig,
           AltCLIPVisionConfig,
       )
       from .processing_altclip import AltCLIPProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_altclip import (
                  ALTCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
                  AltCLIPModel,
                  AltCLIPPreTrainedModel,
                  AltCLIPTextModel,
                  AltCLIPVisionModel,
              )


else:
       import sys

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



