






import copy

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


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

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


class 							__UpperCamelCase     (  _lowerCAmelCase ):
	__snake_case						:Any =							'deta'
	__snake_case						:Union[str, Any] =							{
	    'hidden_size': 'd_model',
	    'num_attention_heads': 'encoder_attention_heads',
	}







	def __init__(	self   :				Optional[Any]							,					_lowerCAmelCase   :				Dict=None							,					_lowerCAmelCase   :				Optional[Any]=900							,					_lowerCAmelCase   :				Optional[Any]=2048							,					_lowerCAmelCase   :				int=6							,					_lowerCAmelCase   :				List[str]=2048							,					_lowerCAmelCase   :				List[Any]=8							,					_lowerCAmelCase   :				str=6							,					_lowerCAmelCase   :				Dict=1024							,					_lowerCAmelCase   :				str=8							,					_lowerCAmelCase   :				str=0.0							,					_lowerCAmelCase   :				List[str]=True							,					_lowerCAmelCase   :				Optional[Any]="relu"							,					_lowerCAmelCase   :				Optional[Any]=256							,					_lowerCAmelCase   :				str=0.1							,					_lowerCAmelCase   :				Dict=0.0							,					_lowerCAmelCase   :				Dict=0.0							,					_lowerCAmelCase   :				Dict=0.02							,					_lowerCAmelCase   :				Optional[int]=1.0							,					_lowerCAmelCase   :				Optional[Any]=True							,					_lowerCAmelCase   :				str=False							,					_lowerCAmelCase   :				Optional[int]="sine"							,					_lowerCAmelCase   :				int=5							,					_lowerCAmelCase   :				int=4							,					_lowerCAmelCase   :				List[str]=4							,					_lowerCAmelCase   :				List[str]=True							,					_lowerCAmelCase   :				int=300							,					_lowerCAmelCase   :				str=True							,					_lowerCAmelCase   :				str=True							,					_lowerCAmelCase   :				Any=1							,					_lowerCAmelCase   :				Dict=5							,					_lowerCAmelCase   :				Dict=2							,					_lowerCAmelCase   :				Any=1							,					_lowerCAmelCase   :				str=1							,					_lowerCAmelCase   :				Union[str, Any]=5							,					_lowerCAmelCase   :				Tuple=2							,					_lowerCAmelCase   :				Tuple=0.1							,					_lowerCAmelCase   :				Optional[Any]=0.25							,					**_lowerCAmelCase   :				Any							,					)		->			Tuple:
		"""simple docstring"""







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

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







	@property
	def 			_a (	self   :				Optional[Any]      )		->			int:
		"""simple docstring"""







		return self.encoder_attention_heads







	@property
	def 			_a (	self   :				Dict      )		->			int:
		"""simple docstring"""







		return self.d_model







	def 			_a (	self   :				List[Any]      )		->			Optional[int]:
		"""simple docstring"""







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









from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_UpperCamelCase			:	Dict								={
    'configuration_albert': ['ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'AlbertConfig', 'AlbertOnnxConfig'],
}

try:
	if not is_sentencepiece_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_UpperCamelCase			:	List[Any]								=['AlbertTokenizer']

try:
	if not is_tokenizers_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_UpperCamelCase			:	List[Any]								=['AlbertTokenizerFast']

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_UpperCamelCase			:	Optional[int]								=[
	    'ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'AlbertForMaskedLM',
	    'AlbertForMultipleChoice',
	    'AlbertForPreTraining',
	    'AlbertForQuestionAnswering',
	    'AlbertForSequenceClassification',
	    'AlbertForTokenClassification',
	    'AlbertModel',
	    'AlbertPreTrainedModel',
	    'load_tf_weights_in_albert',
	]

try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_UpperCamelCase			:	List[Any]								=[
	    'TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'TFAlbertForMaskedLM',
	    'TFAlbertForMultipleChoice',
	    'TFAlbertForPreTraining',
	    'TFAlbertForQuestionAnswering',
	    'TFAlbertForSequenceClassification',
	    'TFAlbertForTokenClassification',
	    'TFAlbertMainLayer',
	    'TFAlbertModel',
	    'TFAlbertPreTrainedModel',
	]

try:
	if not is_flax_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_UpperCamelCase			:	Any								=[
	    'FlaxAlbertForMaskedLM',
	    'FlaxAlbertForMultipleChoice',
	    'FlaxAlbertForPreTraining',
	    'FlaxAlbertForQuestionAnswering',
	    'FlaxAlbertForSequenceClassification',
	    'FlaxAlbertForTokenClassification',
	    'FlaxAlbertModel',
	    'FlaxAlbertPreTrainedModel',
	]

if TYPE_CHECKING:
	from .configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig, AlbertOnnxConfig

	try:
		if not is_sentencepiece_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_albert import AlbertTokenizer

	try:
		if not is_tokenizers_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_albert_fast import AlbertTokenizerFast

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_albert import (
		    ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    AlbertForMaskedLM,
		    AlbertForMultipleChoice,
		    AlbertForPreTraining,
		    AlbertForQuestionAnswering,
		    AlbertForSequenceClassification,
		    AlbertForTokenClassification,
		    AlbertModel,
		    AlbertPreTrainedModel,
		    load_tf_weights_in_albert,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_albert import (
		    TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFAlbertForMaskedLM,
		    TFAlbertForMultipleChoice,
		    TFAlbertForPreTraining,
		    TFAlbertForQuestionAnswering,
		    TFAlbertForSequenceClassification,
		    TFAlbertForTokenClassification,
		    TFAlbertMainLayer,
		    TFAlbertModel,
		    TFAlbertPreTrainedModel,
		)

	try:
		if not is_flax_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_flax_albert import (
		    FlaxAlbertForMaskedLM,
		    FlaxAlbertForMultipleChoice,
		    FlaxAlbertForPreTraining,
		    FlaxAlbertForQuestionAnswering,
		    FlaxAlbertForSequenceClassification,
		    FlaxAlbertForTokenClassification,
		    FlaxAlbertModel,
		    FlaxAlbertPreTrainedModel,
		)
else:
	import sys

	_UpperCamelCase			:	str								=_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



