



import copy

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


UpperCAmelCase__       =	logging.get_logger(__name__)

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







class       __lowerCAmelCase   (      A						):
			UpperCamelCase        =					'''deta'''
			UpperCamelCase        =					{
			    '''hidden_size''': '''d_model''',
			    '''num_attention_heads''': '''encoder_attention_heads''',
			}



			def __init__(						self       :  List[str]			,		A       :  Optional[int]=None			,		A       :  List[str]=9_00			,		A       :  str=20_48			,		A       :  Union[str, Any]=6			,		A       :  Tuple=20_48			,		A       :  Optional[int]=8			,		A       :  Union[str, Any]=6			,		A       :  List[str]=10_24			,		A       :  Dict=8			,		A       :  Union[str, Any]=0.0			,		A       :  Any=True			,		A       :  Tuple="relu"			,		A       :  Tuple=2_56			,		A       :  Any=0.1			,		A       :  Optional[Any]=0.0			,		A       :  Tuple=0.0			,		A       :  Any=0.0_2			,		A       :  int=1.0			,		A       :  Optional[int]=True			,		A       :  Union[str, Any]=False			,		A       :  List[str]="sine"			,		A       :  Union[str, Any]=5			,		A       :  Union[str, Any]=4			,		A       :  int=4			,		A       :  Optional[int]=True			,		A       :  Union[str, Any]=3_00			,		A       :  List[Any]=True			,		A       :  str=True			,		A       :  Optional[Any]=1			,		A       :  List[Any]=5			,		A       :  List[str]=2			,		A       :  int=1			,		A       :  Dict=1			,		A       :  List[Any]=5			,		A       :  int=2			,		A       :  Dict=0.1			,		A       :  int=0.2_5			,		**A       :  Optional[int]			,		)       ->   int:



						"""simple docstring"""






						if backbone_config is None:
									logger.info('`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.')
									_UpperCAmelCase			=       CONFIG_MAPPING['resnet'](out_features=['stage2', 'stage3', 'stage4'])
						else:
									if isinstance(A			,		A):
												_UpperCAmelCase			=       backbone_config.pop('model_type')
												_UpperCAmelCase			=       CONFIG_MAPPING[backbone_model_type]
												_UpperCAmelCase			=       config_class.from_dict(A)

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



			@property
			def    _lowerCamelCase	(						self       :  Any)       ->   int:



						"""simple docstring"""






						return self.encoder_attention_heads



			@property
			def    _lowerCamelCase	(						self       :  List[str])       ->   int:



						"""simple docstring"""






						return self.d_model



			def    _lowerCamelCase	(						self       :  Any)       ->   Optional[Any]:



						"""simple docstring"""






						_UpperCAmelCase			=       copy.deepcopy(self.__dict__)
						_UpperCAmelCase			=       self.backbone_config.to_dict()
						_UpperCAmelCase			=       self.__class__.model_type
						return output






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


UpperCAmelCase__       =	{
    "configuration_mega": ["MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP", "MegaConfig", "MegaOnnxConfig"],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__       =	[
							    "MEGA_PRETRAINED_MODEL_ARCHIVE_LIST",
							    "MegaForCausalLM",
							    "MegaForMaskedLM",
							    "MegaForMultipleChoice",
							    "MegaForQuestionAnswering",
							    "MegaForSequenceClassification",
							    "MegaForTokenClassification",
							    "MegaModel",
							    "MegaPreTrainedModel",
							]

if TYPE_CHECKING:
							from .configuration_mega import MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP, MegaConfig, MegaOnnxConfig

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_mega import (
														    MEGA_PRETRAINED_MODEL_ARCHIVE_LIST,
														    MegaForCausalLM,
														    MegaForMaskedLM,
														    MegaForMultipleChoice,
														    MegaForQuestionAnswering,
														    MegaForSequenceClassification,
														    MegaForTokenClassification,
														    MegaModel,
														    MegaPreTrainedModel,
														)

else:
							import sys

							UpperCAmelCase__       =	_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
