
from manim import *




class  lowerCamelCase__							(				_UpperCAmelCase):




	'''simple docstring'''




	def    _lowerCamelCase				(					self		:Optional[Any]						)		-> Union[str, Any]:
								__UpperCamelCase	:   Union[str, Any]			   =					Rectangle(height=0.5     ,   width=0.5						)
								__UpperCamelCase	:   Union[str, Any]			   =					Rectangle(height=0.46     ,   width=0.46						).set_stroke(width=0						)

								__UpperCamelCase	:   Optional[int]			   =					[mem.copy() for i in range(6						)]
								__UpperCamelCase	:   List[str]			   =					[mem.copy() for i in range(6						)]
								__UpperCamelCase	:   Union[str, Any]			   =					VGroup(*_UpperCAmelCase						).arrange(_UpperCAmelCase     ,   buff=0						)
								__UpperCamelCase	:   int			   =					VGroup(*_UpperCAmelCase						).arrange(_UpperCAmelCase     ,   buff=0						)
								__UpperCamelCase	:   List[str]			   =					VGroup(_UpperCAmelCase     ,   _UpperCAmelCase						).arrange(_UpperCAmelCase     ,   buff=0						)
								__UpperCamelCase	:   str			   =					Text("CPU"     ,   font_size=2_4						)
								__UpperCamelCase	:   Optional[Any]			   =					Group(_UpperCAmelCase     ,   _UpperCAmelCase						).arrange(_UpperCAmelCase     ,   buff=0.5     ,   aligned_edge=_UpperCAmelCase						)
								cpu.move_to([-2.5, -0.5, 0]						)
								self.add(_UpperCAmelCase						)

								__UpperCamelCase	:   Optional[Any]			   =					[mem.copy() for i in range(1						)]
								__UpperCamelCase	:   int			   =					VGroup(*_UpperCAmelCase						).arrange(_UpperCAmelCase     ,   buff=0						)
								__UpperCamelCase	:   Dict			   =					Text("GPU"     ,   font_size=2_4						)
								__UpperCamelCase	:   Any			   =					Group(_UpperCAmelCase     ,   _UpperCAmelCase						).arrange(_UpperCAmelCase     ,   buff=0.5     ,   aligned_edge=_UpperCAmelCase						)
								gpu.align_to(_UpperCAmelCase     ,   _UpperCAmelCase						)
								gpu.set_x(gpu.get_x() - 1						)

								self.add(_UpperCAmelCase						)

								__UpperCamelCase	:   Union[str, Any]			   =					[mem.copy() for i in range(6						)]
								__UpperCamelCase	:   Dict			   =					VGroup(*_UpperCAmelCase						).arrange(_UpperCAmelCase     ,   buff=0						)

								__UpperCamelCase	:   Optional[int]			   =					Text("Model"     ,   font_size=2_4						)
								__UpperCamelCase	:   Tuple			   =					Group(_UpperCAmelCase     ,   _UpperCAmelCase						).arrange(_UpperCAmelCase     ,   buff=0.5     ,   aligned_edge=_UpperCAmelCase						)
								model.move_to([3, -1.0, 0]						)

								self.play(
								    Create(_UpperCAmelCase     ,   run_time=1						)     ,   Create(_UpperCAmelCase     ,   run_time=1						)     ,   Create(_UpperCAmelCase     ,   run_time=1						)     ,   )

								__UpperCamelCase	:   List[Any]			   =					MarkupText(
								    f'First, an empty model skeleton is loaded\ninto <span fgcolor=\'{YELLOW}\'>memory</span> without using much RAM.'     ,   font_size=2_4     ,   )

								__UpperCamelCase	:   str			   =					Square(side_length=2.2						)
								key.move_to([-5, 2, 0]						)

								__UpperCamelCase	:   Optional[Any]			   =					MarkupText(
								    f'<b>Key:</b>\n\n<span fgcolor=\'{YELLOW}\'>●</span> Empty Model'     ,   font_size=1_8     ,   )

								key_text.move_to([-5, 2.4, 0]						)

								step_a.move_to([2, 2, 0]						)
								self.play(Write(_UpperCAmelCase     ,   run_time=2.5						)     ,   Write(_UpperCAmelCase						)     ,   Write(_UpperCAmelCase						)						)

								self.add(_UpperCAmelCase						)

								__UpperCamelCase	:   str			   =					[]
								__UpperCamelCase	:   List[str]			   =					[]
								__UpperCamelCase	:   List[str]			   =					[]
								for i, rect in enumerate(_UpperCAmelCase						):
															__UpperCamelCase	:   Tuple			   =					Rectangle(height=0.46     ,   width=0.46						).set_stroke(width=0.0						).set_fill(_UpperCAmelCase     ,   opacity=0.7						)
															cpu_target.move_to(_UpperCAmelCase						)
															cpu_target.generate_target()
															__UpperCamelCase	:   Dict			   =					0.46 / 4
															__UpperCamelCase	:   str			   =					0.46 / 3

															if i == 0:
																						cpu_target.target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT						)     ,   buff=0.02     ,   direction=_UpperCAmelCase						)
																						cpu_target.target.set_x(cpu_target.target.get_x() + 0.1						)
															elif i == 3:
																						cpu_target.target.next_to(cpu_targs[0].target     ,   direction=_UpperCAmelCase     ,   buff=0.0						)
															else:
																						cpu_target.target.next_to(cpu_targs[i - 1].target     ,   direction=_UpperCAmelCase     ,   buff=0.0						)
															cpu_targs.append(_UpperCAmelCase						)

															first_animations.append(rect.animate(run_time=0.5						).set_stroke(_UpperCAmelCase						)						)
															second_animations.append(MoveToTarget(_UpperCAmelCase     ,   run_time=1.5						)						)

								self.play(*_UpperCAmelCase						)
								self.play(*_UpperCAmelCase						)

								self.wait()
"""simple docstring"""






import copy

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


__A			   = logging.get_logger(__name__)

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


class     UpperCAmelCase						(_UpperCAmelCase  ):



    """simple docstring"""

    _UpperCAmelCase	:Dict						    = "deta"
    _UpperCAmelCase	:Any						    = {
        "hidden_size": "d_model",
        "num_attention_heads": "encoder_attention_heads",
    }






    def __init__(   self    ,			_UpperCAmelCase=None    ,			_UpperCAmelCase=900    ,			_UpperCAmelCase=2048    ,			_UpperCAmelCase=6    ,			_UpperCAmelCase=2048    ,			_UpperCAmelCase=8    ,			_UpperCAmelCase=6    ,			_UpperCAmelCase=1024    ,			_UpperCAmelCase=8    ,			_UpperCAmelCase=0.0    ,			_UpperCAmelCase=True    ,			_UpperCAmelCase="relu"    ,			_UpperCAmelCase=256    ,			_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=300    ,			_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    ,			):
       if backbone_config is None:
          logger.info('''`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.'''							)
          lowercase__:   str					=      CONFIG_MAPPING['''resnet'''](out_features=['''stage2''', '''stage3''', '''stage4''']							)
       else:
          if isinstance(_UpperCAmelCase    ,			_UpperCAmelCase							):
             lowercase__:   Tuple					=      backbone_config.pop('''model_type'''							)
             lowercase__:   str					=      CONFIG_MAPPING[backbone_model_type]
             lowercase__:   Optional[int]					=      config_class.from_dict(_UpperCAmelCase							)

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






    @property
    def _snake_case			(   self							):
       return self.encoder_attention_heads






    @property
    def _snake_case			(   self							):
       return self.d_model






    def _snake_case			(   self							):
       lowercase__:   Union[str, Any]					=      copy.deepcopy(self.__dict__							)
       lowercase__:   Dict					=      self.backbone_config.to_dict()
       lowercase__:   Union[str, Any]					=      self.__class__.model_type
       return output
