import copy

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


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

lowerCamelCase_    :		int							=			{
    """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/config.json""",
}


class 						a__							(       snake_case_		):
			A__    :       Optional[int]        =      'deta'
			A__    :       List[Any]        =      {
			    'hidden_size': 'd_model',
			    'num_attention_heads': 'encoder_attention_heads',
			}



			def __init__(						self				,						UpperCAmelCase=None				,						UpperCAmelCase=9_0_0				,						UpperCAmelCase=2_0_4_8				,						UpperCAmelCase=6				,						UpperCAmelCase=2_0_4_8				,						UpperCAmelCase=8				,						UpperCAmelCase=6				,						UpperCAmelCase=1_0_2_4				,						UpperCAmelCase=8				,						UpperCAmelCase=0.0				,						UpperCAmelCase=True				,						UpperCAmelCase="relu"				,						UpperCAmelCase=2_5_6				,						UpperCAmelCase=0.1				,						UpperCAmelCase=0.0				,						UpperCAmelCase=0.0				,						UpperCAmelCase=0.02				,						UpperCAmelCase=1.0				,						UpperCAmelCase=True				,						UpperCAmelCase=False				,						UpperCAmelCase="sine"				,						UpperCAmelCase=5				,						UpperCAmelCase=4				,						UpperCAmelCase=4				,						UpperCAmelCase=True				,						UpperCAmelCase=3_0_0				,						UpperCAmelCase=True				,						UpperCAmelCase=True				,						UpperCAmelCase=1				,						UpperCAmelCase=5				,						UpperCAmelCase=2				,						UpperCAmelCase=1				,						UpperCAmelCase=1				,						UpperCAmelCase=5				,						UpperCAmelCase=2				,						UpperCAmelCase=0.1				,						UpperCAmelCase=0.25				,						**UpperCAmelCase				,						)			->   str:
								if backbone_config is None:
													logger.info('`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.'   )
													__a		 =       CONFIG_MAPPING['resnet'](out_features=['stage2', 'stage3', 'stage4']   )
								else:
													if isinstance(UpperCAmelCase				,						UpperCAmelCase   ):
																		__a		 =       backbone_config.pop('model_type'   )
																		__a		 =       CONFIG_MAPPING[backbone_model_type]
																		__a		 =       config_class.from_dict(UpperCAmelCase   )

								__a		 =       backbone_config
								__a		 =       num_queries
								__a		 =       max_position_embeddings
								__a		 =       d_model
								__a		 =       encoder_ffn_dim
								__a		 =       encoder_layers
								__a		 =       encoder_attention_heads
								__a		 =       decoder_ffn_dim
								__a		 =       decoder_layers
								__a		 =       decoder_attention_heads
								__a		 =       dropout
								__a		 =       attention_dropout
								__a		 =       activation_dropout
								__a		 =       activation_function
								__a		 =       init_std
								__a		 =       init_xavier_std
								__a		 =       encoder_layerdrop
								__a		 =       auxiliary_loss
								__a		 =       position_embedding_type
								# deformable attributes
								__a		 =       num_feature_levels
								__a		 =       encoder_n_points
								__a		 =       decoder_n_points
								__a		 =       two_stage
								__a		 =       two_stage_num_proposals
								__a		 =       with_box_refine
								__a		 =       assign_first_stage
								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
								__a		 =       class_cost
								__a		 =       bbox_cost
								__a		 =       giou_cost
								# Loss coefficients
								__a		 =       mask_loss_coefficient
								__a		 =       dice_loss_coefficient
								__a		 =       bbox_loss_coefficient
								__a		 =       giou_loss_coefficient
								__a		 =       eos_coefficient
								__a		 =       focal_alpha
								super().__init__(is_encoder_decoder=UpperCAmelCase				,						**UpperCAmelCase   )



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



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







			def __SCREAMING_SNAKE_CASE							(						self   )			->   Tuple:
								__a		 =       copy.deepcopy(self.__dict__   )
								__a		 =       self.backbone_config.to_dict()
								__a		 =       self.__class__.model_type
								return output





from ..utils import DummyObject, requires_backends


class 						a__							(       metaclass=__snake_case		):
			A__    :       List[Any]        =      ['torch', 'transformers', 'onnx']



			def __init__(						self				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   Any:
								requires_backends(self				,						['torch', 'transformers', 'onnx']   )



			@classmethod
			def __SCREAMING_SNAKE_CASE							(						cls				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   Union[str, Any]:
								requires_backends(cls				,						['torch', 'transformers', 'onnx']   )







			@classmethod
			def __SCREAMING_SNAKE_CASE							(						cls				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   List[str]:
								requires_backends(cls				,						['torch', 'transformers', 'onnx']   )






class 						a__							(       metaclass=__snake_case		):
			A__    :       Union[str, Any]        =      ['torch', 'transformers', 'onnx']



			def __init__(						self				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   int:
								requires_backends(self				,						['torch', 'transformers', 'onnx']   )



			@classmethod
			def __SCREAMING_SNAKE_CASE							(						cls				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   int:
								requires_backends(cls				,						['torch', 'transformers', 'onnx']   )







			@classmethod
			def __SCREAMING_SNAKE_CASE							(						cls				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   Dict:
								requires_backends(cls				,						['torch', 'transformers', 'onnx']   )






class 						a__							(       metaclass=__snake_case		):
			A__    :       Dict        =      ['torch', 'transformers', 'onnx']



			def __init__(						self				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   Union[str, Any]:
								requires_backends(self				,						['torch', 'transformers', 'onnx']   )



			@classmethod
			def __SCREAMING_SNAKE_CASE							(						cls				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   Any:
								requires_backends(cls				,						['torch', 'transformers', 'onnx']   )







			@classmethod
			def __SCREAMING_SNAKE_CASE							(						cls				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   int:
								requires_backends(cls				,						['torch', 'transformers', 'onnx']   )






class 						a__							(       metaclass=__snake_case		):
			A__    :       Union[str, Any]        =      ['torch', 'transformers', 'onnx']



			def __init__(						self				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   Optional[Any]:
								requires_backends(self				,						['torch', 'transformers', 'onnx']   )



			@classmethod
			def __SCREAMING_SNAKE_CASE							(						cls				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   int:
								requires_backends(cls				,						['torch', 'transformers', 'onnx']   )







			@classmethod
			def __SCREAMING_SNAKE_CASE							(						cls				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   Union[str, Any]:
								requires_backends(cls				,						['torch', 'transformers', 'onnx']   )






class 						a__							(       metaclass=__snake_case		):
			A__    :       Dict        =      ['torch', 'transformers', 'onnx']



			def __init__(						self				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   Optional[int]:
								requires_backends(self				,						['torch', 'transformers', 'onnx']   )



			@classmethod
			def __SCREAMING_SNAKE_CASE							(						cls				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   Any:
								requires_backends(cls				,						['torch', 'transformers', 'onnx']   )







			@classmethod
			def __SCREAMING_SNAKE_CASE							(						cls				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   str:
								requires_backends(cls				,						['torch', 'transformers', 'onnx']   )






class 						a__							(       metaclass=__snake_case		):
			A__    :       Tuple        =      ['torch', 'transformers', 'onnx']



			def __init__(						self				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   int:
								requires_backends(self				,						['torch', 'transformers', 'onnx']   )



			@classmethod
			def __SCREAMING_SNAKE_CASE							(						cls				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   List[str]:
								requires_backends(cls				,						['torch', 'transformers', 'onnx']   )







			@classmethod
			def __SCREAMING_SNAKE_CASE							(						cls				,						*UpperCAmelCase				,						**UpperCAmelCase   )			->   Any:
								requires_backends(cls				,						['torch', 'transformers', 'onnx']   )




