'''simple docstring'''





import copy

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


lowerCAmelCase_	:		Dict			=     logging.get_logger(__name__)

lowerCAmelCase_	:		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 		SCREAMING_SNAKE_CASE     (					SCREAMING_SNAKE_CASE	):







				'''simple docstring'''
				UpperCAmelCase__							=							'''deformable_detr'''
				UpperCAmelCase__							=							{
				    '''hidden_size''': '''d_model''',
				    '''num_attention_heads''': '''encoder_attention_heads''',
				}





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


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





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


										'''simple docstring'''




										return self.encoder_attention_heads





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


										'''simple docstring'''




										return self.d_model







				def  snake_case__				(						self					:						int					)							->Dict:


										'''simple docstring'''




										_UpperCamelCase			:			Optional[Any]   			=						copy.deepcopy(self.__dict__					)
										if self.backbone_config is not None:
																_UpperCamelCase			:			Dict   			=						self.backbone_config.to_dict()
										_UpperCamelCase			:			int   			=						self.__class__.model_type
										return output



'''simple docstring'''





lowerCAmelCase_	:		Union[str, Any]			=     """
# Transformers 설치 방법
! pip install transformers datasets
# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.
# ! pip install git+https://github.com/huggingface/transformers.git
"""

lowerCAmelCase_	:		List[Any]			=     [{"""type""": """code""", """content""": INSTALL_CONTENT}]
lowerCAmelCase_	:		int			=     {
    """{processor_class}""": """FakeProcessorClass""",
    """{model_class}""": """FakeModelClass""",
    """{object_class}""": """FakeObjectClass""",
}


