
"""simple docstring"""





import unittest

from transformers import MraConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask


if is_torch_available():
    import torch

    from transformers import (
        MraForMaskedLM,
        MraForMultipleChoice,
        MraForQuestionAnswering,
        MraForSequenceClassification,
        MraForTokenClassification,
        MraModel,
    )
    from transformers.models.mra.modeling_mra import MRA_PRETRAINED_MODEL_ARCHIVE_LIST


class A_	:




  '''simple docstring'''







  def __init__(		self				,   lowercase_				,   lowercase_=2				,   lowercase_=8				,   lowercase_=True				,   lowercase_=True				,   lowercase_=True				,   lowercase_=True				,   lowercase_=99				,   lowercase_=16				,   lowercase_=5				,   lowercase_=2				,   lowercase_=36				,   lowercase_="gelu"				,   lowercase_=0.0				,   lowercase_=0.0				,   lowercase_=512				,   lowercase_=16				,   lowercase_=2				,   lowercase_=0.02				,   lowercase_=3				,   lowercase_=4				,   lowercase_=None				,   ):

     """simple docstring"""
     UpperCAmelCase_					:					int			     =    parent
     UpperCAmelCase_					:					Optional[Any]			     =    batch_size
     UpperCAmelCase_					:					Any			     =    seq_length
     UpperCAmelCase_					:					Optional[int]			     =    is_training
     UpperCAmelCase_					:					int			     =    use_input_mask
     UpperCAmelCase_					:					Optional[Any]			     =    use_token_type_ids
     UpperCAmelCase_					:					Dict			     =    use_labels
     UpperCAmelCase_					:					Union[str, Any]			     =    vocab_size
     UpperCAmelCase_					:					Union[str, Any]			     =    hidden_size
     UpperCAmelCase_					:					List[Any]			     =    num_hidden_layers
     UpperCAmelCase_					:					Optional[int]			     =    num_attention_heads
     UpperCAmelCase_					:					Dict			     =    intermediate_size
     UpperCAmelCase_					:					List[Any]			     =    hidden_act
     UpperCAmelCase_					:					int			     =    hidden_dropout_prob
     UpperCAmelCase_					:					List[str]			     =    attention_probs_dropout_prob
     UpperCAmelCase_					:					Any			     =    max_position_embeddings
     UpperCAmelCase_					:					int			     =    type_vocab_size
     UpperCAmelCase_					:					int			     =    type_sequence_label_size
     UpperCAmelCase_					:					Tuple			     =    initializer_range
     UpperCAmelCase_					:					Tuple			     =    num_labels
     UpperCAmelCase_					:					List[str]			     =    num_choices
     UpperCAmelCase_					:					Any			     =    scope







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					Optional[int]			     =    ids_tensor([self.batch_size, self.seq_length]				,   self.vocab_size  )

     UpperCAmelCase_					:					Tuple			     =    None
     if self.use_input_mask:
        UpperCAmelCase_					:					List[str]			     =    random_attention_mask([self.batch_size, self.seq_length]  )

     UpperCAmelCase_					:					Any			     =    None
     if self.use_token_type_ids:
        UpperCAmelCase_					:					Tuple			     =    ids_tensor([self.batch_size, self.seq_length]				,   self.type_vocab_size  )

     UpperCAmelCase_					:					Optional[Any]			     =    None
     UpperCAmelCase_					:					Optional[int]			     =    None
     UpperCAmelCase_					:					Optional[Any]			     =    None
     if self.use_labels:
        UpperCAmelCase_					:					int			     =    ids_tensor([self.batch_size]				,   self.type_sequence_label_size  )
        UpperCAmelCase_					:					Optional[int]			     =    ids_tensor([self.batch_size, self.seq_length]				,   self.num_labels  )
        UpperCAmelCase_					:					str			     =    ids_tensor([self.batch_size]				,   self.num_choices  )

     UpperCAmelCase_					:					int			     =    self.get_config()

     return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     return MraConfig(
         vocab_size=self.vocab_size				,   hidden_size=self.hidden_size				,   num_hidden_layers=self.num_hidden_layers				,   num_attention_heads=self.num_attention_heads				,   intermediate_size=self.intermediate_size				,   hidden_act=self.hidden_act				,   hidden_dropout_prob=self.hidden_dropout_prob				,   attention_probs_dropout_prob=self.attention_probs_dropout_prob				,   max_position_embeddings=self.max_position_embeddings				,   type_vocab_size=self.type_vocab_size				,   is_decoder=lowercase_				,   initializer_range=self.initializer_range				,   )







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					int			     =    self.get_config()
     UpperCAmelCase_					:					List[Any]			     =    300
     return config







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     (
         (
         UpperCAmelCase_
     )     ,   (
         UpperCAmelCase_
     )     ,   (
         UpperCAmelCase_
     )     ,   (
         UpperCAmelCase_
     )     ,   (
         UpperCAmelCase_
     )     ,   (
         UpperCAmelCase_
     )     ,   (
         UpperCAmelCase_
     )     ,   
     )					:					Union[str, Any]			     =    self.prepare_config_and_inputs()

     UpperCAmelCase_					:					str			     =    True
     UpperCAmelCase_					:					Union[str, Any]			     =    floats_tensor([self.batch_size, self.seq_length, self.hidden_size]  )
     UpperCAmelCase_					:					Dict			     =    ids_tensor([self.batch_size, self.seq_length]				,   vocab_size=2  )

     return (
         config,
         input_ids,
         token_type_ids,
         input_mask,
         sequence_labels,
         token_labels,
         choice_labels,
         encoder_hidden_states,
         encoder_attention_mask,
     )







  def        UpperCamelCase__					(		self				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_  ):

     """simple docstring"""
     UpperCAmelCase_					:					Optional[Any]			     =    MraModel(config=lowercase_  )
     model.to(lowercase_  )
     model.eval()
     UpperCAmelCase_					:					Tuple			     =    model(lowercase_				,   attention_mask=lowercase_				,   token_type_ids=lowercase_  )
     UpperCAmelCase_					:					Optional[int]			     =    model(lowercase_				,   token_type_ids=lowercase_  )
     UpperCAmelCase_					:					Tuple			     =    model(lowercase_  )
     self.parent.assertEqual(result.last_hidden_state.shape				,   (self.batch_size, self.seq_length, self.hidden_size)  )







  def        UpperCamelCase__					(		self				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   ):

     """simple docstring"""
     UpperCAmelCase_					:					Any			     =    True
     UpperCAmelCase_					:					Union[str, Any]			     =    MraModel(lowercase_  )
     model.to(lowercase_  )
     model.eval()
     UpperCAmelCase_					:					List[str]			     =    model(
         lowercase_				,   attention_mask=lowercase_				,   token_type_ids=lowercase_				,   encoder_hidden_states=lowercase_				,   encoder_attention_mask=lowercase_				,   )
     UpperCAmelCase_					:					Union[str, Any]			     =    model(
         lowercase_				,   attention_mask=lowercase_				,   token_type_ids=lowercase_				,   encoder_hidden_states=lowercase_				,   )
     UpperCAmelCase_					:					Dict			     =    model(lowercase_				,   attention_mask=lowercase_				,   token_type_ids=lowercase_  )
     self.parent.assertEqual(result.last_hidden_state.shape				,   (self.batch_size, self.seq_length, self.hidden_size)  )







  def        UpperCamelCase__					(		self				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_  ):

     """simple docstring"""
     UpperCAmelCase_					:					str			     =    MraForMaskedLM(config=lowercase_  )
     model.to(lowercase_  )
     model.eval()
     UpperCAmelCase_					:					List[str]			     =    model(lowercase_				,   attention_mask=lowercase_				,   token_type_ids=lowercase_				,   labels=lowercase_  )
     self.parent.assertEqual(result.logits.shape				,   (self.batch_size, self.seq_length, self.vocab_size)  )







  def        UpperCamelCase__					(		self				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_  ):

     """simple docstring"""
     UpperCAmelCase_					:					Dict			     =    MraForQuestionAnswering(config=lowercase_  )
     model.to(lowercase_  )
     model.eval()
     UpperCAmelCase_					:					int			     =    model(
         lowercase_				,   attention_mask=lowercase_				,   token_type_ids=lowercase_				,   start_positions=lowercase_				,   end_positions=lowercase_				,   )
     self.parent.assertEqual(result.start_logits.shape				,   (self.batch_size, self.seq_length)  )
     self.parent.assertEqual(result.end_logits.shape				,   (self.batch_size, self.seq_length)  )







  def        UpperCamelCase__					(		self				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_  ):

     """simple docstring"""
     UpperCAmelCase_					:					Dict			     =    self.num_labels
     UpperCAmelCase_					:					Dict			     =    MraForSequenceClassification(lowercase_  )
     model.to(lowercase_  )
     model.eval()
     UpperCAmelCase_					:					List[Any]			     =    model(lowercase_				,   attention_mask=lowercase_				,   token_type_ids=lowercase_				,   labels=lowercase_  )
     self.parent.assertEqual(result.logits.shape				,   (self.batch_size, self.num_labels)  )







  def        UpperCamelCase__					(		self				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_  ):

     """simple docstring"""
     UpperCAmelCase_					:					str			     =    self.num_labels
     UpperCAmelCase_					:					int			     =    MraForTokenClassification(config=lowercase_  )
     model.to(lowercase_  )
     model.eval()
     UpperCAmelCase_					:					List[Any]			     =    model(lowercase_				,   attention_mask=lowercase_				,   token_type_ids=lowercase_				,   labels=lowercase_  )
     self.parent.assertEqual(result.logits.shape				,   (self.batch_size, self.seq_length, self.num_labels)  )







  def        UpperCamelCase__					(		self				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_				,   lowercase_  ):

     """simple docstring"""
     UpperCAmelCase_					:					Dict			     =    self.num_choices
     UpperCAmelCase_					:					List[Any]			     =    MraForMultipleChoice(config=lowercase_  )
     model.to(lowercase_  )
     model.eval()
     UpperCAmelCase_					:					Optional[int]			     =    input_ids.unsqueeze(1  ).expand(-1				,   self.num_choices				,   -1  ).contiguous()
     UpperCAmelCase_					:					Union[str, Any]			     =    token_type_ids.unsqueeze(1  ).expand(-1				,   self.num_choices				,   -1  ).contiguous()
     UpperCAmelCase_					:					Optional[int]			     =    input_mask.unsqueeze(1  ).expand(-1				,   self.num_choices				,   -1  ).contiguous()
     UpperCAmelCase_					:					int			     =    model(
         lowercase_				,   attention_mask=lowercase_				,   token_type_ids=lowercase_				,   labels=lowercase_				,   )
     self.parent.assertEqual(result.logits.shape				,   (self.batch_size, self.num_choices)  )







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					Union[str, Any]			     =    self.prepare_config_and_inputs()
     (
         (
         UpperCAmelCase_
     )     ,   (
         UpperCAmelCase_
     )     ,   (
         UpperCAmelCase_
     )     ,   (
         UpperCAmelCase_
     )     ,   (
         UpperCAmelCase_
     )     ,   (
         UpperCAmelCase_
     )     ,   (
         UpperCAmelCase_
     )     ,   
     )					:					Optional[Any]			     =    config_and_inputs
     UpperCAmelCase_					:					List[str]			     =    {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
     return config, inputs_dict




@require_torch
class A_	(lowercase__				,unittest.TestCase      ):




  '''simple docstring'''
  SCREAMING_SNAKE_CASE__			:						Tuple       =		(
      (
          MraModel,
          MraForMaskedLM,
          MraForMultipleChoice,
          MraForQuestionAnswering,
          MraForSequenceClassification,
          MraForTokenClassification,
      )
      if is_torch_available()
      else ()
  )
  SCREAMING_SNAKE_CASE__			:						Optional[int]       =		False
  SCREAMING_SNAKE_CASE__			:						Optional[int]       =		False
  SCREAMING_SNAKE_CASE__			:						List[str]       =		False
  SCREAMING_SNAKE_CASE__			:						Tuple       =		False

  SCREAMING_SNAKE_CASE__			:						Dict       =		()







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					Optional[Any]			     =    MraModelTester(self  )
     UpperCAmelCase_					:					Tuple			     =    ConfigTester(self				,   config_class=lowercase_				,   hidden_size=37  )







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     self.config_tester.run_common_tests()







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					Dict			     =    self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_model(*lowercase_  )







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					Any			     =    self.model_tester.prepare_config_and_inputs()
     for type in ["absolute", "relative_key", "relative_key_query"]:
        UpperCAmelCase_					:					Tuple			     =    type
        self.model_tester.create_and_check_model(*lowercase_  )







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					Dict			     =    self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_for_masked_lm(*lowercase_  )







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					str			     =    self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_for_multiple_choice(*lowercase_  )







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					str			     =    self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_for_question_answering(*lowercase_  )







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					Optional[Any]			     =    self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_for_sequence_classification(*lowercase_  )







  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					List[str]			     =    self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_for_token_classification(*lowercase_  )







  @slow
  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     for model_name in MRA_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        UpperCAmelCase_					:					Optional[int]			     =    MraModel.from_pretrained(lowercase_  )
        self.assertIsNotNone(lowercase_  )







  @unittest.skip(reason="MRA does not output attentions"  )
  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     return




@require_torch
class A_	(unittest.TestCase      ):




  '''simple docstring'''







  @slow
  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					Any			     =    MraModel.from_pretrained("uw-madison/mra-base-512-4"  )
     UpperCAmelCase_					:					List[str]			     =    torch.arange(256  ).unsqueeze(0  )

     with torch.no_grad():
        UpperCAmelCase_					:					Optional[Any]			     =    model(lowercase_  )[0]

     UpperCAmelCase_					:					str			     =    torch.Size((1, 256, 768)  )
     self.assertEqual(output.shape				,   lowercase_  )

     UpperCAmelCase_					:					Optional[Any]			     =    torch.tensor(
         [[[-0.01_40, 0.08_30, -0.03_81], [0.15_46, 0.14_02, 0.02_20], [0.11_62, 0.08_51, 0.01_65]]]  )

     self.assertTrue(torch.allclose(output[:, :3, :3]				,   lowercase_				,   atol=1E-4  )  )







  @slow
  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					Tuple			     =    MraForMaskedLM.from_pretrained("uw-madison/mra-base-512-4"  )
     UpperCAmelCase_					:					Optional[int]			     =    torch.arange(256  ).unsqueeze(0  )

     with torch.no_grad():
        UpperCAmelCase_					:					Dict			     =    model(lowercase_  )[0]

     UpperCAmelCase_					:					Dict			     =    5_0265

     UpperCAmelCase_					:					str			     =    torch.Size((1, 256, vocab_size)  )
     self.assertEqual(output.shape				,   lowercase_  )

     UpperCAmelCase_					:					Optional[int]			     =    torch.tensor(
         [[[9.25_95, -3.60_38, 11.88_19], [9.38_69, -3.26_93, 11.09_56], [11.85_24, -3.49_38, 13.12_10]]]  )

     self.assertTrue(torch.allclose(output[:, :3, :3]				,   lowercase_				,   atol=1E-4  )  )







  @slow
  def        UpperCamelCase__					(		self  ):

     """simple docstring"""
     UpperCAmelCase_					:					Dict			     =    MraForMaskedLM.from_pretrained("uw-madison/mra-base-4096-8-d3"  )
     UpperCAmelCase_					:					List[Any]			     =    torch.arange(4096  ).unsqueeze(0  )

     with torch.no_grad():
        UpperCAmelCase_					:					str			     =    model(lowercase_  )[0]

     UpperCAmelCase_					:					List[str]			     =    5_0265

     UpperCAmelCase_					:					Tuple			     =    torch.Size((1, 4096, vocab_size)  )
     self.assertEqual(output.shape				,   lowercase_  )

     UpperCAmelCase_					:					Optional[int]			     =    torch.tensor(
         [[[5.47_89, -2.35_64, 7.50_64], [7.90_67, -1.33_69, 9.96_68], [9.07_12, -1.81_06, 7.03_80]]]  )

     self.assertTrue(torch.allclose(output[:, :3, :3]				,   lowercase_				,   atol=1E-4  )  )



import copy

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


__lowercase							 =					logging.get_logger(__name__)

__lowercase							 =					{
    '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.json''',
    # See all Deformable DETR models at https://huggingface.co/models?filter=deformable-detr
}


class 	lowerCamelCase_     (   UpperCAmelCase_ ):






    '''simple docstring'''






    a__	:						List[str]						=      """deformable_detr"""
    a__	:						Union[str, Any]						=      {
        """hidden_size""": """d_model""",
        """num_attention_heads""": """encoder_attention_heads""",
    }







    def __init__(	self , __lowercase=True , __lowercase=None , __lowercase=3 , __lowercase=300 , __lowercase=1_024 , __lowercase=6 , __lowercase=1_024 , __lowercase=8 , __lowercase=6 , __lowercase=1_024 , __lowercase=8 , __lowercase=0.0 , __lowercase=True , __lowercase="relu" , __lowercase=256 , __lowercase=0.1 , __lowercase=0.0 , __lowercase=0.0 , __lowercase=0.02 , __lowercase=1.0 , __lowercase=True , __lowercase=False , __lowercase="sine" , __lowercase="resnet50" , __lowercase=True , __lowercase=False , __lowercase=4 , __lowercase=4 , __lowercase=4 , __lowercase=False , __lowercase=300 , __lowercase=False , __lowercase=1 , __lowercase=5 , __lowercase=2 , __lowercase=1 , __lowercase=1 , __lowercase=5 , __lowercase=2 , __lowercase=0.1 , __lowercase=0.25 , __lowercase=False , **__lowercase , )       ->	int:
        if backbone_config is not None and use_timm_backbone:
            raise ValueError('''You can\'t specify both `backbone_config` and `use_timm_backbone`.''')

        if not use_timm_backbone:
            if backbone_config is None:
                logger.info('''`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.''')
                __UpperCamelCase     :str			  =		CONFIG_MAPPING['''resnet'''](out_features=['''stage4'''])
            elif isinstance(__lowercase , __lowercase):
                __UpperCamelCase     :str			  =		backbone_config.get('''model_type''')
                __UpperCamelCase     :Tuple			  =		CONFIG_MAPPING[backbone_model_type]
                __UpperCamelCase     :Any			  =		config_class.from_dict(__lowercase)
        __UpperCamelCase     :int			  =		use_timm_backbone
        __UpperCamelCase     :Dict			  =		backbone_config
        __UpperCamelCase     :Any			  =		num_channels
        __UpperCamelCase     :Optional[int]			  =		num_queries
        __UpperCamelCase     :Any			  =		max_position_embeddings
        __UpperCamelCase     :str			  =		d_model
        __UpperCamelCase     :Tuple			  =		encoder_ffn_dim
        __UpperCamelCase     :Union[str, Any]			  =		encoder_layers
        __UpperCamelCase     :List[Any]			  =		encoder_attention_heads
        __UpperCamelCase     :Any			  =		decoder_ffn_dim
        __UpperCamelCase     :List[str]			  =		decoder_layers
        __UpperCamelCase     :int			  =		decoder_attention_heads
        __UpperCamelCase     :str			  =		dropout
        __UpperCamelCase     :Any			  =		attention_dropout
        __UpperCamelCase     :int			  =		activation_dropout
        __UpperCamelCase     :List[Any]			  =		activation_function
        __UpperCamelCase     :List[Any]			  =		init_std
        __UpperCamelCase     :List[Any]			  =		init_xavier_std
        __UpperCamelCase     :int			  =		encoder_layerdrop
        __UpperCamelCase     :str			  =		auxiliary_loss
        __UpperCamelCase     :Optional[Any]			  =		position_embedding_type
        __UpperCamelCase     :Union[str, Any]			  =		backbone
        __UpperCamelCase     :Any			  =		use_pretrained_backbone
        __UpperCamelCase     :str			  =		dilation
        # deformable attributes
        __UpperCamelCase     :Optional[Any]			  =		num_feature_levels
        __UpperCamelCase     :str			  =		encoder_n_points
        __UpperCamelCase     :int			  =		decoder_n_points
        __UpperCamelCase     :Union[str, Any]			  =		two_stage
        __UpperCamelCase     :Optional[Any]			  =		two_stage_num_proposals
        __UpperCamelCase     :Dict			  =		with_box_refine
        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     :Optional[int]			  =		class_cost
        __UpperCamelCase     :List[Any]			  =		bbox_cost
        __UpperCamelCase     :str			  =		giou_cost
        # Loss coefficients
        __UpperCamelCase     :Tuple			  =		mask_loss_coefficient
        __UpperCamelCase     :Tuple			  =		dice_loss_coefficient
        __UpperCamelCase     :int			  =		bbox_loss_coefficient
        __UpperCamelCase     :Any			  =		giou_loss_coefficient
        __UpperCamelCase     :Dict			  =		eos_coefficient
        __UpperCamelCase     :Optional[Any]			  =		focal_alpha
        __UpperCamelCase     :Optional[Any]			  =		disable_custom_kernels
        super().__init__(is_encoder_decoder=__lowercase , **__lowercase)







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







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







    def 			UpperCamelCase__   (	self)       ->	List[Any]:
        __UpperCamelCase     :Dict			  =		copy.deepcopy(self.__dict__)
        if self.backbone_config is not None:
            __UpperCamelCase     :Tuple			  =		self.backbone_config.to_dict()
        __UpperCamelCase     :List[Any]			  =		self.__class__.model_type
        return output





