


import copy

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


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

a_ :Dict  							=			{
    '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  (						_UpperCAmelCase			):
     lowerCamelCase			:			Tuple      = '''deformable_detr'''
     lowerCamelCase			:			Optional[int]      = {
         '''hidden_size''': '''d_model''',
         '''num_attention_heads''': '''encoder_attention_heads''',
     }







     def __init__(						self :						Dict   ,   _lowercase :						int=True   ,   _lowercase :						Tuple=None   ,   _lowercase :						str=3   ,   _lowercase :						str=3_00   ,   _lowercase :						Any=10_24   ,   _lowercase :						Optional[int]=6   ,   _lowercase :						str=10_24   ,   _lowercase :						List[str]=8   ,   _lowercase :						List[str]=6   ,   _lowercase :						Tuple=10_24   ,   _lowercase :						int=8   ,   _lowercase :						Union[str, Any]=0.0   ,   _lowercase :						Tuple=True   ,   _lowercase :						Optional[Any]="relu"   ,   _lowercase :						List[str]=2_56   ,   _lowercase :						Dict=0.1   ,   _lowercase :						Tuple=0.0   ,   _lowercase :						Tuple=0.0   ,   _lowercase :						Tuple=0.02   ,   _lowercase :						Optional[int]=1.0   ,   _lowercase :						Dict=True   ,   _lowercase :						List[str]=False   ,   _lowercase :						Dict="sine"   ,   _lowercase :						Any="resnet50"   ,   _lowercase :						Any=True   ,   _lowercase :						List[str]=False   ,   _lowercase :						int=4   ,   _lowercase :						Optional[Any]=4   ,   _lowercase :						int=4   ,   _lowercase :						Optional[Any]=False   ,   _lowercase :						Dict=3_00   ,   _lowercase :						List[Any]=False   ,   _lowercase :						List[str]=1   ,   _lowercase :						Tuple=5   ,   _lowercase :						int=2   ,   _lowercase :						List[str]=1   ,   _lowercase :						Optional[Any]=1   ,   _lowercase :						Optional[Any]=5   ,   _lowercase :						Optional[Any]=2   ,   _lowercase :						str=0.1   ,   _lowercase :						List[Any]=0.25   ,   _lowercase :						Optional[int]=False   ,   **_lowercase :						Any   ,   ):
           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__       :  Any						     =		CONFIG_MAPPING['''resnet'''](out_features=['''stage4''']      )
                 elif isinstance(_lowercase   ,   _lowercase      ):
                       SCREAMING_SNAKE_CASE__       :  int						     =		backbone_config.get('''model_type'''      )
                       SCREAMING_SNAKE_CASE__       :  List[str]						     =		CONFIG_MAPPING[backbone_model_type]
                       SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		config_class.from_dict(_lowercase      )
           SCREAMING_SNAKE_CASE__       :  Dict						     =		use_timm_backbone
           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		backbone_config
           SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		num_channels
           SCREAMING_SNAKE_CASE__       :  Optional[Any]						     =		num_queries
           SCREAMING_SNAKE_CASE__       :  List[Any]						     =		max_position_embeddings
           SCREAMING_SNAKE_CASE__       :  Any						     =		d_model
           SCREAMING_SNAKE_CASE__       :  Any						     =		encoder_ffn_dim
           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		encoder_layers
           SCREAMING_SNAKE_CASE__       :  Dict						     =		encoder_attention_heads
           SCREAMING_SNAKE_CASE__       :  Any						     =		decoder_ffn_dim
           SCREAMING_SNAKE_CASE__       :  Any						     =		decoder_layers
           SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		decoder_attention_heads
           SCREAMING_SNAKE_CASE__       :  List[Any]						     =		dropout
           SCREAMING_SNAKE_CASE__       :  Dict						     =		attention_dropout
           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		activation_dropout
           SCREAMING_SNAKE_CASE__       :  Tuple						     =		activation_function
           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		init_std
           SCREAMING_SNAKE_CASE__       :  Tuple						     =		init_xavier_std
           SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		encoder_layerdrop
           SCREAMING_SNAKE_CASE__       :  Optional[Any]						     =		auxiliary_loss
           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		position_embedding_type
           SCREAMING_SNAKE_CASE__       :  Tuple						     =		backbone
           SCREAMING_SNAKE_CASE__       :  int						     =		use_pretrained_backbone
           SCREAMING_SNAKE_CASE__       :  Any						     =		dilation
           # deformable attributes
           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		num_feature_levels
           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		encoder_n_points
           SCREAMING_SNAKE_CASE__       :  Any						     =		decoder_n_points
           SCREAMING_SNAKE_CASE__       :  Tuple						     =		two_stage
           SCREAMING_SNAKE_CASE__       :  Dict						     =		two_stage_num_proposals
           SCREAMING_SNAKE_CASE__       :  Tuple						     =		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__       :  int						     =		class_cost
           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		bbox_cost
           SCREAMING_SNAKE_CASE__       :  int						     =		giou_cost
           # Loss coefficients
           SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		mask_loss_coefficient
           SCREAMING_SNAKE_CASE__       :  List[Any]						     =		dice_loss_coefficient
           SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		bbox_loss_coefficient
           SCREAMING_SNAKE_CASE__       :  List[Any]						     =		giou_loss_coefficient
           SCREAMING_SNAKE_CASE__       :  Optional[Any]						     =		eos_coefficient
           SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		focal_alpha
           SCREAMING_SNAKE_CASE__       :  List[Any]						     =		disable_custom_kernels
           super().__init__(is_encoder_decoder=_lowercase   ,   **_lowercase      )







     @property
     def 							lowercase__       (						self :						Optional[int]      ):
           return self.encoder_attention_heads







     @property
     def 							lowercase__       (						self :						Optional[int]      ):
           return self.d_model







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







from ...configuration_utils import PretrainedConfig
from ...utils import logging


a  :      List[Any]            =    logging.get_logger(__name__)

a  :      Any            =    {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json"""}

class 					_lowercase    (     UpperCAmelCase__			):






    '''simple docstring'''
    SCREAMING_SNAKE_CASE:				int          =    'openai-gpt'
    SCREAMING_SNAKE_CASE:				List[str]          =    {
        'max_position_embeddings': 'n_positions',
        'hidden_size': 'n_embd',
        'num_attention_heads': 'n_head',
        'num_hidden_layers': 'n_layer',
    }




    def __init__(    self       ,						lowerCamelCase__=40_478       ,						lowerCamelCase__=512       ,						lowerCamelCase__=768       ,						lowerCamelCase__=12       ,						lowerCamelCase__=12       ,						lowerCamelCase__="gelu"       ,						lowerCamelCase__=0.1       ,						lowerCamelCase__=0.1       ,						lowerCamelCase__=0.1       ,						lowerCamelCase__=1E-5       ,						lowerCamelCase__=0.0_2       ,						lowerCamelCase__="cls_index"       ,						lowerCamelCase__=True       ,						lowerCamelCase__=None       ,						lowerCamelCase__=True       ,						lowerCamelCase__=0.1       ,						**lowerCamelCase__       ,						):
       lowerCAmelCase_:							Union[str, Any]       =	vocab_size
       lowerCAmelCase_:							List[Any]       =	n_positions
       lowerCAmelCase_:							Tuple       =	n_embd
       lowerCAmelCase_:							Optional[int]       =	n_layer
       lowerCAmelCase_:							Optional[int]       =	n_head
       lowerCAmelCase_:							int       =	afn
       lowerCAmelCase_:							str       =	resid_pdrop
       lowerCAmelCase_:							Optional[int]       =	embd_pdrop
       lowerCAmelCase_:							Optional[int]       =	attn_pdrop
       lowerCAmelCase_:							Dict       =	layer_norm_epsilon
       lowerCAmelCase_:							List[Any]       =	initializer_range
       lowerCAmelCase_:							Union[str, Any]       =	summary_type
       lowerCAmelCase_:							Any       =	summary_use_proj
       lowerCAmelCase_:							Dict       =	summary_activation
       lowerCAmelCase_:							Dict       =	summary_first_dropout
       lowerCAmelCase_:							List[Any]       =	summary_proj_to_labels
       super().__init__(**lowerCamelCase__ )