



import copy

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


_lowerCamelCase						    =  logging.get_logger(__name__)

_lowerCamelCase						    =  {
    """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformable-detr/resolve/main/config.json""",
    # See all Deformable DETR models at https://huggingface.co/models?filter=deformable-detr
}

class       _SCREAMING_SNAKE_CASE	(UpperCamelCase ):
     lowerCAmelCase					=			"""deformable_detr"""
     lowerCAmelCase					=			{
         """hidden_size""": """d_model""",
         """num_attention_heads""": """encoder_attention_heads""",
     }





     def __init__(       self :							Dict     ,  UpperCamelCase :							List[Any]=True     ,  UpperCamelCase :							Optional[Any]=None     ,  UpperCamelCase :							List[str]=3     ,  UpperCamelCase :							int=3_0_0     ,  UpperCamelCase :							Union[str, Any]=1_0_2_4     ,  UpperCamelCase :							int=6     ,  UpperCamelCase :							List[str]=1_0_2_4     ,  UpperCamelCase :							Any=8     ,  UpperCamelCase :							int=6     ,  UpperCamelCase :							List[Any]=1_0_2_4     ,  UpperCamelCase :							Optional[Any]=8     ,  UpperCamelCase :							Any=0.0     ,  UpperCamelCase :							Optional[int]=True     ,  UpperCamelCase :							Optional[int]="relu"     ,  UpperCamelCase :							List[str]=2_5_6     ,  UpperCamelCase :							Optional[int]=0.1     ,  UpperCamelCase :							Any=0.0     ,  UpperCamelCase :							Dict=0.0     ,  UpperCamelCase :							str=0.0_2     ,  UpperCamelCase :							Optional[int]=1.0     ,  UpperCamelCase :							Optional[Any]=True     ,  UpperCamelCase :							List[str]=False     ,  UpperCamelCase :							Union[str, Any]="sine"     ,  UpperCamelCase :							Union[str, Any]="resnet50"     ,  UpperCamelCase :							List[Any]=True     ,  UpperCamelCase :							List[str]=False     ,  UpperCamelCase :							Optional[Any]=4     ,  UpperCamelCase :							Optional[int]=4     ,  UpperCamelCase :							int=4     ,  UpperCamelCase :							Tuple=False     ,  UpperCamelCase :							Tuple=3_0_0     ,  UpperCamelCase :							Any=False     ,  UpperCamelCase :							Dict=1     ,  UpperCamelCase :							Any=5     ,  UpperCamelCase :							Optional[int]=2     ,  UpperCamelCase :							Dict=1     ,  UpperCamelCase :							int=1     ,  UpperCamelCase :							Dict=5     ,  UpperCamelCase :							Tuple=2     ,  UpperCamelCase :							Tuple=0.1     ,  UpperCamelCase :							Any=0.2_5     ,  UpperCamelCase :							Any=False     ,  **UpperCamelCase :							Optional[int]     ,  )->List[str]:






      if backbone_config is not None and use_timm_backbone:
       raise ValueError("You can't specify both `backbone_config` and `use_timm_backbone`."				)

      if not use_timm_backbone:
       if backbone_config is None:
        logger.info("`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone."				)
        __SCREAMING_SNAKE_CASE       :    int       =	CONFIG_MAPPING["resnet"](out_features=["stage4"]				)
       elif isinstance(_SCREAMING_SNAKE_CASE     ,  _SCREAMING_SNAKE_CASE				):
        __SCREAMING_SNAKE_CASE       :    Tuple       =	backbone_config.get("model_type"				)
        __SCREAMING_SNAKE_CASE       :    Optional[int]       =	CONFIG_MAPPING[backbone_model_type]
        __SCREAMING_SNAKE_CASE       :    List[Any]       =	config_class.from_dict(_SCREAMING_SNAKE_CASE				)
      __SCREAMING_SNAKE_CASE       :    List[Any]       =	use_timm_backbone
      __SCREAMING_SNAKE_CASE       :    Tuple       =	backbone_config
      __SCREAMING_SNAKE_CASE       :    str       =	num_channels
      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	num_queries
      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	max_position_embeddings
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	d_model
      __SCREAMING_SNAKE_CASE       :    Tuple       =	encoder_ffn_dim
      __SCREAMING_SNAKE_CASE       :    Any       =	encoder_layers
      __SCREAMING_SNAKE_CASE       :    int       =	encoder_attention_heads
      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	decoder_ffn_dim
      __SCREAMING_SNAKE_CASE       :    List[Any]       =	decoder_layers
      __SCREAMING_SNAKE_CASE       :    str       =	decoder_attention_heads
      __SCREAMING_SNAKE_CASE       :    int       =	dropout
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	attention_dropout
      __SCREAMING_SNAKE_CASE       :    List[str]       =	activation_dropout
      __SCREAMING_SNAKE_CASE       :    Tuple       =	activation_function
      __SCREAMING_SNAKE_CASE       :    List[Any]       =	init_std
      __SCREAMING_SNAKE_CASE       :    List[Any]       =	init_xavier_std
      __SCREAMING_SNAKE_CASE       :    Dict       =	encoder_layerdrop
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	auxiliary_loss
      __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	position_embedding_type
      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	backbone
      __SCREAMING_SNAKE_CASE       :    Tuple       =	use_pretrained_backbone
      __SCREAMING_SNAKE_CASE       :    Any       =	dilation
      # deformable attributes
      __SCREAMING_SNAKE_CASE       :    Dict       =	num_feature_levels
      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	encoder_n_points
      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	decoder_n_points
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	two_stage
      __SCREAMING_SNAKE_CASE       :    Tuple       =	two_stage_num_proposals
      __SCREAMING_SNAKE_CASE       :    List[str]       =	with_box_refine
      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
      __SCREAMING_SNAKE_CASE       :    Any       =	class_cost
      __SCREAMING_SNAKE_CASE       :    int       =	bbox_cost
      __SCREAMING_SNAKE_CASE       :    List[str]       =	giou_cost
      # Loss coefficients
      __SCREAMING_SNAKE_CASE       :    List[Any]       =	mask_loss_coefficient
      __SCREAMING_SNAKE_CASE       :    Dict       =	dice_loss_coefficient
      __SCREAMING_SNAKE_CASE       :    List[str]       =	bbox_loss_coefficient
      __SCREAMING_SNAKE_CASE       :    List[str]       =	giou_loss_coefficient
      __SCREAMING_SNAKE_CASE       :    int       =	eos_coefficient
      __SCREAMING_SNAKE_CASE       :    List[str]       =	focal_alpha
      __SCREAMING_SNAKE_CASE       :    List[Any]       =	disable_custom_kernels
      super().__init__(is_encoder_decoder=_SCREAMING_SNAKE_CASE     ,  **_SCREAMING_SNAKE_CASE				)





     @property
     def 	__snake_case    (       self :							Tuple				)->int:
      return self.encoder_attention_heads





     @property
     def 	__snake_case    (       self :							Tuple				)->int:
      return self.d_model






     def 	__snake_case    (       self :							Any				)->Tuple:
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	copy.deepcopy(self.__dict__				)
      if self.backbone_config is not None:
       __SCREAMING_SNAKE_CASE       :    List[Any]       =	self.backbone_config.to_dict()
      __SCREAMING_SNAKE_CASE       :    Tuple       =	self.__class__.model_type
      return output











from diffusers.utils.testing_utils import require_onnxruntime

@require_onnxruntime
class       _SCREAMING_SNAKE_CASE	:
     pass






