




from typing import List

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


lowercase__				:     List[str] 		=						logging.get_logger(__name__)

lowercase__				:     int 		=						{
    "snap-research/efficientformer-l1-300": (
        "https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/config.json"
    ),
}
class 		UpperCAmelCase   (				_a			):







						'''simple docstring'''





						lowerCAmelCase_     		=   """efficientformer"""






						def __init__(						self							:     Any       ,	__lowercase							:     Any = [3, 2, 6, 4]       ,	__lowercase							:     Tuple = [48, 96, 2_24, 4_48]       ,	__lowercase							:     str = [True, True, True, True]       ,	__lowercase							:     Tuple = 4_48       ,	__lowercase							:     str = 32       ,	__lowercase							:     List[str] = 4       ,	__lowercase							:     List[str] = 7       ,	__lowercase							:     List[Any] = 5       ,	__lowercase							:     Tuple = 8       ,	__lowercase							:     Optional[Any] = 4       ,	__lowercase							:     Optional[Any] = 0.0       ,	__lowercase							:     Any = 16       ,	__lowercase							:     Dict = 3       ,	__lowercase							:     Any = 3       ,	__lowercase							:     Union[str, Any] = 3       ,	__lowercase							:     str = 2       ,	__lowercase							:     Tuple = 1       ,	__lowercase							:     Dict = 0.0       ,	__lowercase							:     int = 1       ,	__lowercase							:     Any = True       ,	__lowercase							:     str = True       ,	__lowercase							:     List[Any] = 1E-5       ,	__lowercase							:     Tuple = "gelu"       ,	__lowercase							:     Union[str, Any] = 0.02       ,	__lowercase							:     Union[str, Any] = 1E-12       ,	__lowercase							:     List[Any] = 2_24       ,	__lowercase							:     Optional[Any] = 1E-05       ,	**__lowercase							:     Optional[Any]       ,	):






							"""simple docstring"""






							super().__init__(**__lowercase						)

							snake_case_		    =     hidden_act
							snake_case_		    =     hidden_dropout_prob
							snake_case_		    =     hidden_sizes
							snake_case_		    =     num_hidden_layers
							snake_case_		    =     num_attention_heads
							snake_case_		    =     initializer_range
							snake_case_		    =     layer_norm_eps
							snake_case_		    =     patch_size
							snake_case_		    =     num_channels
							snake_case_		    =     depths
							snake_case_		    =     mlp_expansion_ratio
							snake_case_		    =     downsamples
							snake_case_		    =     dim
							snake_case_		    =     key_dim
							snake_case_		    =     attention_ratio
							snake_case_		    =     resolution
							snake_case_		    =     pool_size
							snake_case_		    =     downsample_patch_size
							snake_case_		    =     downsample_stride
							snake_case_		    =     downsample_pad
							snake_case_		    =     drop_path_rate
							snake_case_		    =     num_metaad_blocks
							snake_case_		    =     distillation
							snake_case_		    =     use_layer_scale
							snake_case_		    =     layer_scale_init_value
							snake_case_		    =     image_size
							snake_case_		    =     batch_norm_eps




import copy

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


SCREAMING_SNAKE_CASE       :      int												= logging.get_logger(__name__)

SCREAMING_SNAKE_CASE       :      List[str]												= {
    "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 _lowerCamelCase(						_a   ):
       lowercase_ :	Dict     =			"""deformable_detr"""
       lowercase_ :	int     =			{
           """hidden_size""": """d_model""",
           """num_attention_heads""": """encoder_attention_heads""",
       }
       def __init__(					self,      lowerCamelCase=True,      lowerCamelCase=None,      lowerCamelCase=3,      lowerCamelCase=3_00,      lowerCamelCase=10_24,      lowerCamelCase=6,      lowerCamelCase=10_24,      lowerCamelCase=8,      lowerCamelCase=6,      lowerCamelCase=10_24,      lowerCamelCase=8,      lowerCamelCase=0.0,      lowerCamelCase=True,      lowerCamelCase="relu",      lowerCamelCase=2_56,      lowerCamelCase=0.1,      lowerCamelCase=0.0,      lowerCamelCase=0.0,      lowerCamelCase=0.0_2,      lowerCamelCase=1.0,      lowerCamelCase=True,      lowerCamelCase=False,      lowerCamelCase="sine",      lowerCamelCase="resnet50",      lowerCamelCase=True,      lowerCamelCase=False,      lowerCamelCase=4,      lowerCamelCase=4,      lowerCamelCase=4,      lowerCamelCase=False,      lowerCamelCase=3_00,      lowerCamelCase=False,      lowerCamelCase=1,      lowerCamelCase=5,      lowerCamelCase=2,      lowerCamelCase=1,      lowerCamelCase=1,      lowerCamelCase=5,      lowerCamelCase=2,      lowerCamelCase=0.1,      lowerCamelCase=0.2_5,      lowerCamelCase=False,      **lowerCamelCase,      )       ->   Optional[int]:




           """simple docstring"""

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




           """simple docstring"""

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




           """simple docstring"""

           return self.d_model




       def 			UpperCamelCase     (					self)       ->   Union[str, Any]:




           """simple docstring"""

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


