






import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING


__a:     Optional[Any]   					=					logging.get_logger(__name__)

__a:     Optional[int]   					=					{
    '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json''',
}
class 		SCREAMING_SNAKE_CASE__	(  UpperCAmelCase     ):

  '''simple docstring'''







  _lowerCamelCase    =  '''deta'''
  _lowerCamelCase    =  {
      '''hidden_size''': '''d_model''',
      '''num_attention_heads''': '''encoder_attention_heads''',
  }


  def __init__(      self		:			Any       ,				lowerCamelCase		:			Union[str, Any]=None       ,				lowerCamelCase		:			Optional[int]=900       ,				lowerCamelCase		:			Tuple=2048       ,				lowerCamelCase		:			Optional[int]=6       ,				lowerCamelCase		:			Optional[int]=2048       ,				lowerCamelCase		:			Any=8       ,				lowerCamelCase		:			int=6       ,				lowerCamelCase		:			Optional[Any]=1024       ,				lowerCamelCase		:			str=8       ,				lowerCamelCase		:			Union[str, Any]=0.0       ,				lowerCamelCase		:			List[str]=True       ,				lowerCamelCase		:			Union[str, Any]="relu"       ,				lowerCamelCase		:			Tuple=256       ,				lowerCamelCase		:			List[str]=0.1       ,				lowerCamelCase		:			Union[str, Any]=0.0       ,				lowerCamelCase		:			int=0.0       ,				lowerCamelCase		:			Tuple=0.02       ,				lowerCamelCase		:			int=1.0       ,				lowerCamelCase		:			List[str]=True       ,				lowerCamelCase		:			Dict=False       ,				lowerCamelCase		:			Union[str, Any]="sine"       ,				lowerCamelCase		:			Tuple=5       ,				lowerCamelCase		:			List[Any]=4       ,				lowerCamelCase		:			int=4       ,				lowerCamelCase		:			List[str]=True       ,				lowerCamelCase		:			List[Any]=300       ,				lowerCamelCase		:			str=True       ,				lowerCamelCase		:			List[str]=True       ,				lowerCamelCase		:			Any=1       ,				lowerCamelCase		:			int=5       ,				lowerCamelCase		:			List[Any]=2       ,				lowerCamelCase		:			Union[str, Any]=1       ,				lowerCamelCase		:			Dict=1       ,				lowerCamelCase		:			int=5       ,				lowerCamelCase		:			List[Any]=2       ,				lowerCamelCase		:			Tuple=0.1       ,				lowerCamelCase		:			str=0.25       ,				**lowerCamelCase		:			Tuple       ,				)						->	Dict:


         """simple docstring"""
         if backbone_config is None:
                logger.info("""`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone."""							)
                _UpperCAmelCase							=    CONFIG_MAPPING["""resnet"""](out_features=["""stage2""", """stage3""", """stage4"""]							)
         else:
                if isinstance(lowerCamelCase       ,				lowerCamelCase							):
                       _UpperCAmelCase							=    backbone_config.pop("""model_type"""							)
                       _UpperCAmelCase							=    CONFIG_MAPPING[backbone_model_type]
                       _UpperCAmelCase							=    config_class.from_dict(lowerCamelCase							)

         _UpperCAmelCase							=    backbone_config
         _UpperCAmelCase							=    num_queries
         _UpperCAmelCase							=    max_position_embeddings
         _UpperCAmelCase							=    d_model
         _UpperCAmelCase							=    encoder_ffn_dim
         _UpperCAmelCase							=    encoder_layers
         _UpperCAmelCase							=    encoder_attention_heads
         _UpperCAmelCase							=    decoder_ffn_dim
         _UpperCAmelCase							=    decoder_layers
         _UpperCAmelCase							=    decoder_attention_heads
         _UpperCAmelCase							=    dropout
         _UpperCAmelCase							=    attention_dropout
         _UpperCAmelCase							=    activation_dropout
         _UpperCAmelCase							=    activation_function
         _UpperCAmelCase							=    init_std
         _UpperCAmelCase							=    init_xavier_std
         _UpperCAmelCase							=    encoder_layerdrop
         _UpperCAmelCase							=    auxiliary_loss
         _UpperCAmelCase							=    position_embedding_type
         # deformable attributes
         _UpperCAmelCase							=    num_feature_levels
         _UpperCAmelCase							=    encoder_n_points
         _UpperCAmelCase							=    decoder_n_points
         _UpperCAmelCase							=    two_stage
         _UpperCAmelCase							=    two_stage_num_proposals
         _UpperCAmelCase							=    with_box_refine
         _UpperCAmelCase							=    assign_first_stage
         if two_stage is True and with_box_refine is False:
                raise ValueError("""If two_stage is True, with_box_refine must be True."""							)
         # Hungarian matcher
         _UpperCAmelCase							=    class_cost
         _UpperCAmelCase							=    bbox_cost
         _UpperCAmelCase							=    giou_cost
         # Loss coefficients
         _UpperCAmelCase							=    mask_loss_coefficient
         _UpperCAmelCase							=    dice_loss_coefficient
         _UpperCAmelCase							=    bbox_loss_coefficient
         _UpperCAmelCase							=    giou_loss_coefficient
         _UpperCAmelCase							=    eos_coefficient
         _UpperCAmelCase							=    focal_alpha
         super().__init__(is_encoder_decoder=lowerCamelCase       ,				**lowerCamelCase							)


  @property
  def  lowerCamelCase       (      self		:			int							)						->	int:


         """simple docstring"""
         return self.encoder_attention_heads


  @property
  def  lowerCamelCase       (      self		:			Dict							)						->	int:


         """simple docstring"""
         return self.d_model





  def  lowerCamelCase       (      self		:			Tuple							)						->	Tuple:


         """simple docstring"""
         _UpperCAmelCase							=    copy.deepcopy(self.__dict__							)
         _UpperCAmelCase							=    self.backbone_config.to_dict()
         _UpperCAmelCase							=    self.__class__.model_type
         return output







__a:     List[Any]   					=					{
    '''Pillow''': '''Pillow''',
    '''accelerate''': '''accelerate>=0.11.0''',
    '''compel''': '''compel==0.1.8''',
    '''black''': '''black~=23.1''',
    '''datasets''': '''datasets''',
    '''filelock''': '''filelock''',
    '''flax''': '''flax>=0.4.1''',
    '''hf-doc-builder''': '''hf-doc-builder>=0.3.0''',
    '''huggingface-hub''': '''huggingface-hub>=0.13.2''',
    '''requests-mock''': '''requests-mock==1.10.0''',
    '''importlib_metadata''': '''importlib_metadata''',
    '''invisible-watermark''': '''invisible-watermark''',
    '''isort''': '''isort>=5.5.4''',
    '''jax''': '''jax>=0.2.8,!=0.3.2''',
    '''jaxlib''': '''jaxlib>=0.1.65''',
    '''Jinja2''': '''Jinja2''',
    '''k-diffusion''': '''k-diffusion>=0.0.12''',
    '''torchsde''': '''torchsde''',
    '''note_seq''': '''note_seq''',
    '''librosa''': '''librosa''',
    '''numpy''': '''numpy''',
    '''omegaconf''': '''omegaconf''',
    '''parameterized''': '''parameterized''',
    '''protobuf''': '''protobuf>=3.20.3,<4''',
    '''pytest''': '''pytest''',
    '''pytest-timeout''': '''pytest-timeout''',
    '''pytest-xdist''': '''pytest-xdist''',
    '''ruff''': '''ruff>=0.0.241''',
    '''safetensors''': '''safetensors''',
    '''sentencepiece''': '''sentencepiece>=0.1.91,!=0.1.92''',
    '''scipy''': '''scipy''',
    '''onnx''': '''onnx''',
    '''regex''': '''regex!=2019.12.17''',
    '''requests''': '''requests''',
    '''tensorboard''': '''tensorboard''',
    '''torch''': '''torch>=1.4''',
    '''torchvision''': '''torchvision''',
    '''transformers''': '''transformers>=4.25.1''',
    '''urllib3''': '''urllib3<=2.0.0''',
}