





import copy

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


__lowercase  :   int						      =logging.get_logger(__name__)

__lowercase  :   Optional[Any]						      ={
    """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/config.json""",
}

class      A       (	__lowercase						):
      _snake_case							     ='''deta'''
      _snake_case							     ={
          '''hidden_size''': '''d_model''',
          '''num_attention_heads''': '''encoder_attention_heads''',
      }



      def __init__(	self:						Optional[Any]		,  _lowerCAmelCase:						Tuple=None		,  _lowerCAmelCase:						Dict=900		,  _lowerCAmelCase:						List[Any]=2048		,  _lowerCAmelCase:						List[str]=6		,  _lowerCAmelCase:						Tuple=2048		,  _lowerCAmelCase:						Optional[Any]=8		,  _lowerCAmelCase:						List[str]=6		,  _lowerCAmelCase:						Optional[int]=1024		,  _lowerCAmelCase:						List[str]=8		,  _lowerCAmelCase:						str=0.0		,  _lowerCAmelCase:						Dict=True		,  _lowerCAmelCase:						int="relu"		,  _lowerCAmelCase:						Union[str, Any]=256		,  _lowerCAmelCase:						str=0.1		,  _lowerCAmelCase:						Any=0.0		,  _lowerCAmelCase:						List[str]=0.0		,  _lowerCAmelCase:						Optional[Any]=0.02		,  _lowerCAmelCase:						List[str]=1.0		,  _lowerCAmelCase:						List[Any]=True		,  _lowerCAmelCase:						Optional[Any]=False		,  _lowerCAmelCase:						List[Any]="sine"		,  _lowerCAmelCase:						Dict=5		,  _lowerCAmelCase:						Optional[Any]=4		,  _lowerCAmelCase:						List[str]=4		,  _lowerCAmelCase:						Dict=True		,  _lowerCAmelCase:						List[Any]=300		,  _lowerCAmelCase:						Dict=True		,  _lowerCAmelCase:						Optional[int]=True		,  _lowerCAmelCase:						Optional[int]=1		,  _lowerCAmelCase:						Tuple=5		,  _lowerCAmelCase:						Any=2		,  _lowerCAmelCase:						List[Any]=1		,  _lowerCAmelCase:						Any=1		,  _lowerCAmelCase:						Dict=5		,  _lowerCAmelCase:						int=2		,  _lowerCAmelCase:						Dict=0.1		,  _lowerCAmelCase:						List[str]=0.25		,  **_lowerCAmelCase:						int		,  )						->    Tuple:
         '''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(_lowerCAmelCase		,  _lowerCAmelCase       ):
               UpperCAmelCase_											=backbone_config.pop("model_type"       )
               UpperCAmelCase_											=CONFIG_MAPPING[backbone_model_type]
               UpperCAmelCase_											=config_class.from_dict(_lowerCAmelCase       )

         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=_lowerCAmelCase		,  **_lowerCAmelCase       )



      @property
      def 	lowerCAmelCase__    (	self:						Any       )						->    int:
         '''simple docstring'''

         return self.encoder_attention_heads



      @property
      def 	lowerCAmelCase__    (	self:						Tuple       )						->    int:
         '''simple docstring'''

         return self.d_model






      def 	lowerCAmelCase__    (	self:						Dict       )						->    Union[str, 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_tf_available, is_torch_available


__lowercase  :   Optional[Any]						      ={
    """configuration_groupvit""": [
        """GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """GroupViTConfig""",
        """GroupViTOnnxConfig""",
        """GroupViTTextConfig""",
        """GroupViTVisionConfig""",
    ],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     __lowercase  :   List[Any]						      =[
         """GROUPVIT_PRETRAINED_MODEL_ARCHIVE_LIST""",
         """GroupViTModel""",
         """GroupViTPreTrainedModel""",
         """GroupViTTextModel""",
         """GroupViTVisionModel""",
     ]

try:
     if not is_tf_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     __lowercase  :   List[str]						      =[
         """TF_GROUPVIT_PRETRAINED_MODEL_ARCHIVE_LIST""",
         """TFGroupViTModel""",
         """TFGroupViTPreTrainedModel""",
         """TFGroupViTTextModel""",
         """TFGroupViTVisionModel""",
     ]

if TYPE_CHECKING:
     from .configuration_groupvit import (
         GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP,
         GroupViTConfig,
         GroupViTOnnxConfig,
         GroupViTTextConfig,
         GroupViTVisionConfig,
     )

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_groupvit import (
              GROUPVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
              GroupViTModel,
              GroupViTPreTrainedModel,
              GroupViTTextModel,
              GroupViTVisionModel,
          )

     try:
          if not is_tf_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_tf_groupvit import (
              TF_GROUPVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
              TFGroupViTModel,
              TFGroupViTPreTrainedModel,
              TFGroupViTTextModel,
              TFGroupViTVisionModel,
          )

else:
     import sys

     __lowercase  :   str						      =_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)




