



import copy

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


__snake_case						:Dict						=					logging.get_logger(__name__)

__snake_case						:Dict						=					{
    '''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    _A	(     __UpperCAmelCase   ):
       UpperCamelCase__  :   List[str]						 =						'''dpt'''



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


           '''simple docstring'''

           super().__init__(**__SCREAMING_SNAKE_CASE)

           __a							=    hidden_size
           __a							=    is_hybrid

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

               __a							=    backbone_featmap_shape
               __a							=    neck_ignore_stages

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

           __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
           __a							=    backbone_out_indices
           if readout_type not in ["ignore", "add", "project"]:
               raise ValueError('''Readout_type must be one of [\'ignore\', \'add\', \'project\']''')
           __a							=    readout_type
           __a							=    reassemble_factors
           __a							=    neck_hidden_sizes
           __a							=    fusion_hidden_size
           __a							=    head_in_index
           __a							=    use_batch_norm_in_fusion_residual
           # auxiliary head attributes (semantic segmentation)
           __a							=    use_auxiliary_head
           __a							=    auxiliary_loss_weight
           __a							=    semantic_loss_ignore_index
           __a							=    semantic_classifier_dropout





       def 		_lowerCamelCase      (		self							:					str):


           '''simple docstring'''

           __a							=    copy.deepcopy(self.__dict__)

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

           __a							=    self.__class__.model_type
           return output










from typing import TYPE_CHECKING

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


__snake_case						:Tuple						=					{
    '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''],
}
try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __snake_case						:List[Any]						=					['''BloomTokenizerFast''']

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __snake_case						:Any						=					[
     '''BLOOM_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''BloomForCausalLM''',
     '''BloomModel''',
     '''BloomPreTrainedModel''',
     '''BloomForSequenceClassification''',
     '''BloomForTokenClassification''',
     '''BloomForQuestionAnswering''',
 ]

if TYPE_CHECKING:
 from .configuration_bloom import BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP, BloomConfig, BloomOnnxConfig

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_bloom_fast import BloomTokenizerFast

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_bloom import (
      BLOOM_PRETRAINED_MODEL_ARCHIVE_LIST,
      BloomForCausalLM,
      BloomForQuestionAnswering,
      BloomForSequenceClassification,
      BloomForTokenClassification,
      BloomModel,
      BloomPreTrainedModel,
  )

else:
 import sys

 __snake_case						:Any						=					_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





