


import copy

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


a_ :Any  							=			logging.get_logger(__name__)

a_ :List[Any]  							=			{
    '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 							lowercase  (						A_			):
     lowerCamelCase			:			Dict      = "deformable_detr"
     lowerCamelCase			:			Dict      = {
         "hidden_size": "d_model",
         "num_attention_heads": "encoder_attention_heads",
     }







     def __init__(						self :						Any   ,   _lowercase :						List[str]=True   ,   _lowercase :						int=None   ,   _lowercase :						Any=3   ,   _lowercase :						Dict=3_00   ,   _lowercase :						Optional[Any]=10_24   ,   _lowercase :						Optional[Any]=6   ,   _lowercase :						Union[str, Any]=10_24   ,   _lowercase :						Optional[int]=8   ,   _lowercase :						Tuple=6   ,   _lowercase :						Dict=10_24   ,   _lowercase :						Optional[Any]=8   ,   _lowercase :						Any=0.0   ,   _lowercase :						Tuple=True   ,   _lowercase :						Any="relu"   ,   _lowercase :						Tuple=2_56   ,   _lowercase :						Union[str, Any]=0.1   ,   _lowercase :						int=0.0   ,   _lowercase :						Any=0.0   ,   _lowercase :						Optional[int]=0.02   ,   _lowercase :						Optional[Any]=1.0   ,   _lowercase :						Any=True   ,   _lowercase :						List[str]=False   ,   _lowercase :						List[str]="sine"   ,   _lowercase :						Optional[Any]="resnet50"   ,   _lowercase :						int=True   ,   _lowercase :						Union[str, Any]=False   ,   _lowercase :						int=4   ,   _lowercase :						Any=4   ,   _lowercase :						Any=4   ,   _lowercase :						int=False   ,   _lowercase :						str=3_00   ,   _lowercase :						Dict=False   ,   _lowercase :						Optional[Any]=1   ,   _lowercase :						Tuple=5   ,   _lowercase :						List[Any]=2   ,   _lowercase :						Optional[Any]=1   ,   _lowercase :						Dict=1   ,   _lowercase :						int=5   ,   _lowercase :						Optional[Any]=2   ,   _lowercase :						List[str]=0.1   ,   _lowercase :						Tuple=0.25   ,   _lowercase :						List[str]=False   ,   **_lowercase :						Dict   ,   ):


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







     @property
     def 							lowercase__       (						self :						Any      ):
           return self.encoder_attention_heads







     @property
     def 							lowercase__       (						self :						Union[str, Any]      ):
           return self.d_model







     def 							lowercase__       (						self :						str      ):
           SCREAMING_SNAKE_CASE__       :  Any						     =		copy.deepcopy(self.__dict__      )
           if self.backbone_config is not None:
                 SCREAMING_SNAKE_CASE__       :  Dict						     =		self.backbone_config.to_dict()
           SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		self.__class__.model_type
           return output








def      UpperCamelCase   (       __lowerCamelCase	:					int = 1							,   __lowerCamelCase	:					int = 1000       ):
       snake_case			:  int     							= 1
       snake_case			:  int     							= 0

       for divide_by_number in range(__lowerCamelCase							,   digit + 1       ):
              snake_case			:  list[int]     							= []
              snake_case			:  Optional[int]     							= numerator
              for _ in range(1							,   digit + 1       ):
                     if now_divide in has_been_divided:
                            if longest_list_length < len(__lowerCamelCase       ):
                                   snake_case			:  List[Any]     							= len(__lowerCamelCase       )
                                   snake_case			:  List[str]     							= divide_by_number
                     else:
                            has_been_divided.append(__lowerCamelCase       )
                            snake_case			:  Any     							= now_divide * 10 % divide_by_number

       return the_digit


# Tests
if __name__ == "__main__":
   import doctest

   doctest.testmod()





