



from typing import TYPE_CHECKING

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


UpperCamelCase_									=   {
    '''auto_factory''': ['''get_values'''],
    '''configuration_auto''': ['''ALL_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CONFIG_MAPPING''', '''MODEL_NAMES_MAPPING''', '''AutoConfig'''],
    '''feature_extraction_auto''': ['''FEATURE_EXTRACTOR_MAPPING''', '''AutoFeatureExtractor'''],
    '''image_processing_auto''': ['''IMAGE_PROCESSOR_MAPPING''', '''AutoImageProcessor'''],
    '''processing_auto''': ['''PROCESSOR_MAPPING''', '''AutoProcessor'''],
    '''tokenization_auto''': ['''TOKENIZER_MAPPING''', '''AutoTokenizer'''],
}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      UpperCamelCase_									=   [
          '''MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING''',
          '''MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING''',
          '''MODEL_FOR_AUDIO_XVECTOR_MAPPING''',
          '''MODEL_FOR_BACKBONE_MAPPING''',
          '''MODEL_FOR_CAUSAL_IMAGE_MODELING_MAPPING''',
          '''MODEL_FOR_CAUSAL_LM_MAPPING''',
          '''MODEL_FOR_CTC_MAPPING''',
          '''MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING''',
          '''MODEL_FOR_DEPTH_ESTIMATION_MAPPING''',
          '''MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING''',
          '''MODEL_FOR_IMAGE_SEGMENTATION_MAPPING''',
          '''MODEL_FOR_INSTANCE_SEGMENTATION_MAPPING''',
          '''MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING''',
          '''MODEL_FOR_MASKED_LM_MAPPING''',
          '''MODEL_FOR_MASK_GENERATION_MAPPING''',
          '''MODEL_FOR_MULTIPLE_CHOICE_MAPPING''',
          '''MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING''',
          '''MODEL_FOR_OBJECT_DETECTION_MAPPING''',
          '''MODEL_FOR_PRETRAINING_MAPPING''',
          '''MODEL_FOR_QUESTION_ANSWERING_MAPPING''',
          '''MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING''',
          '''MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING''',
          '''MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING''',
          '''MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING''',
          '''MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING''',
          '''MODEL_FOR_TEXT_ENCODING_MAPPING''',
          '''MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING''',
          '''MODEL_FOR_UNIVERSAL_SEGMENTATION_MAPPING''',
          '''MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING''',
          '''MODEL_FOR_VISION_2_SEQ_MAPPING''',
          '''MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING''',
          '''MODEL_MAPPING''',
          '''MODEL_WITH_LM_HEAD_MAPPING''',
          '''MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING''',
          '''MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING''',
          '''AutoModel''',
          '''AutoBackbone''',
          '''AutoModelForAudioClassification''',
          '''AutoModelForAudioFrameClassification''',
          '''AutoModelForAudioXVector''',
          '''AutoModelForCausalLM''',
          '''AutoModelForCTC''',
          '''AutoModelForDepthEstimation''',
          '''AutoModelForImageClassification''',
          '''AutoModelForImageSegmentation''',
          '''AutoModelForInstanceSegmentation''',
          '''AutoModelForMaskGeneration''',
          '''AutoModelForTextEncoding''',
          '''AutoModelForMaskedImageModeling''',
          '''AutoModelForMaskedLM''',
          '''AutoModelForMultipleChoice''',
          '''AutoModelForNextSentencePrediction''',
          '''AutoModelForObjectDetection''',
          '''AutoModelForPreTraining''',
          '''AutoModelForQuestionAnswering''',
          '''AutoModelForSemanticSegmentation''',
          '''AutoModelForSeq2SeqLM''',
          '''AutoModelForSequenceClassification''',
          '''AutoModelForSpeechSeq2Seq''',
          '''AutoModelForTableQuestionAnswering''',
          '''AutoModelForTokenClassification''',
          '''AutoModelForUniversalSegmentation''',
          '''AutoModelForVideoClassification''',
          '''AutoModelForVision2Seq''',
          '''AutoModelForVisualQuestionAnswering''',
          '''AutoModelForDocumentQuestionAnswering''',
          '''AutoModelWithLMHead''',
          '''AutoModelForZeroShotImageClassification''',
          '''AutoModelForZeroShotObjectDetection''',
      ]

try:
      if not is_tf_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      UpperCamelCase_									=   [
          '''TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING''',
          '''TF_MODEL_FOR_CAUSAL_LM_MAPPING''',
          '''TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING''',
          '''TF_MODEL_FOR_MASK_GENERATION_MAPPING''',
          '''TF_MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING''',
          '''TF_MODEL_FOR_MASKED_LM_MAPPING''',
          '''TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING''',
          '''TF_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING''',
          '''TF_MODEL_FOR_PRETRAINING_MAPPING''',
          '''TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING''',
          '''TF_MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING''',
          '''TF_MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING''',
          '''TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING''',
          '''TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING''',
          '''TF_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING''',
          '''TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING''',
          '''TF_MODEL_FOR_TEXT_ENCODING_MAPPING''',
          '''TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING''',
          '''TF_MODEL_FOR_VISION_2_SEQ_MAPPING''',
          '''TF_MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING''',
          '''TF_MODEL_MAPPING''',
          '''TF_MODEL_WITH_LM_HEAD_MAPPING''',
          '''TFAutoModel''',
          '''TFAutoModelForAudioClassification''',
          '''TFAutoModelForCausalLM''',
          '''TFAutoModelForImageClassification''',
          '''TFAutoModelForMaskedImageModeling''',
          '''TFAutoModelForMaskedLM''',
          '''TFAutoModelForMaskGeneration''',
          '''TFAutoModelForMultipleChoice''',
          '''TFAutoModelForNextSentencePrediction''',
          '''TFAutoModelForPreTraining''',
          '''TFAutoModelForDocumentQuestionAnswering''',
          '''TFAutoModelForQuestionAnswering''',
          '''TFAutoModelForSemanticSegmentation''',
          '''TFAutoModelForSeq2SeqLM''',
          '''TFAutoModelForSequenceClassification''',
          '''TFAutoModelForSpeechSeq2Seq''',
          '''TFAutoModelForTableQuestionAnswering''',
          '''TFAutoModelForTextEncoding''',
          '''TFAutoModelForTokenClassification''',
          '''TFAutoModelForVision2Seq''',
          '''TFAutoModelForZeroShotImageClassification''',
          '''TFAutoModelWithLMHead''',
      ]

try:
      if not is_flax_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      UpperCamelCase_									=   [
          '''FLAX_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING''',
          '''FLAX_MODEL_FOR_CAUSAL_LM_MAPPING''',
          '''FLAX_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING''',
          '''FLAX_MODEL_FOR_MASKED_LM_MAPPING''',
          '''FLAX_MODEL_FOR_MULTIPLE_CHOICE_MAPPING''',
          '''FLAX_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING''',
          '''FLAX_MODEL_FOR_PRETRAINING_MAPPING''',
          '''FLAX_MODEL_FOR_QUESTION_ANSWERING_MAPPING''',
          '''FLAX_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING''',
          '''FLAX_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING''',
          '''FLAX_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING''',
          '''FLAX_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING''',
          '''FLAX_MODEL_FOR_VISION_2_SEQ_MAPPING''',
          '''FLAX_MODEL_MAPPING''',
          '''FlaxAutoModel''',
          '''FlaxAutoModelForCausalLM''',
          '''FlaxAutoModelForImageClassification''',
          '''FlaxAutoModelForMaskedLM''',
          '''FlaxAutoModelForMultipleChoice''',
          '''FlaxAutoModelForNextSentencePrediction''',
          '''FlaxAutoModelForPreTraining''',
          '''FlaxAutoModelForQuestionAnswering''',
          '''FlaxAutoModelForSeq2SeqLM''',
          '''FlaxAutoModelForSequenceClassification''',
          '''FlaxAutoModelForSpeechSeq2Seq''',
          '''FlaxAutoModelForTokenClassification''',
          '''FlaxAutoModelForVision2Seq''',
      ]


if TYPE_CHECKING:
      from .auto_factory import get_values
      from .configuration_auto import ALL_PRETRAINED_CONFIG_ARCHIVE_MAP, CONFIG_MAPPING, MODEL_NAMES_MAPPING, AutoConfig
      from .feature_extraction_auto import FEATURE_EXTRACTOR_MAPPING, AutoFeatureExtractor
      from .image_processing_auto import IMAGE_PROCESSOR_MAPPING, AutoImageProcessor
      from .processing_auto import PROCESSOR_MAPPING, AutoProcessor
      from .tokenization_auto import TOKENIZER_MAPPING, AutoTokenizer

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_auto import (
                MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING,
                MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING,
                MODEL_FOR_AUDIO_XVECTOR_MAPPING,
                MODEL_FOR_BACKBONE_MAPPING,
                MODEL_FOR_CAUSAL_IMAGE_MODELING_MAPPING,
                MODEL_FOR_CAUSAL_LM_MAPPING,
                MODEL_FOR_CTC_MAPPING,
                MODEL_FOR_DEPTH_ESTIMATION_MAPPING,
                MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING,
                MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING,
                MODEL_FOR_IMAGE_SEGMENTATION_MAPPING,
                MODEL_FOR_INSTANCE_SEGMENTATION_MAPPING,
                MODEL_FOR_MASK_GENERATION_MAPPING,
                MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING,
                MODEL_FOR_MASKED_LM_MAPPING,
                MODEL_FOR_MULTIPLE_CHOICE_MAPPING,
                MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING,
                MODEL_FOR_OBJECT_DETECTION_MAPPING,
                MODEL_FOR_PRETRAINING_MAPPING,
                MODEL_FOR_QUESTION_ANSWERING_MAPPING,
                MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING,
                MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
                MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
                MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING,
                MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING,
                MODEL_FOR_TEXT_ENCODING_MAPPING,
                MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING,
                MODEL_FOR_UNIVERSAL_SEGMENTATION_MAPPING,
                MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING,
                MODEL_FOR_VISION_2_SEQ_MAPPING,
                MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING,
                MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING,
                MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING,
                MODEL_MAPPING,
                MODEL_WITH_LM_HEAD_MAPPING,
                AutoBackbone,
                AutoModel,
                AutoModelForAudioClassification,
                AutoModelForAudioFrameClassification,
                AutoModelForAudioXVector,
                AutoModelForCausalLM,
                AutoModelForCTC,
                AutoModelForDepthEstimation,
                AutoModelForDocumentQuestionAnswering,
                AutoModelForImageClassification,
                AutoModelForImageSegmentation,
                AutoModelForInstanceSegmentation,
                AutoModelForMaskedImageModeling,
                AutoModelForMaskedLM,
                AutoModelForMaskGeneration,
                AutoModelForMultipleChoice,
                AutoModelForNextSentencePrediction,
                AutoModelForObjectDetection,
                AutoModelForPreTraining,
                AutoModelForQuestionAnswering,
                AutoModelForSemanticSegmentation,
                AutoModelForSeqaSeqLM,
                AutoModelForSequenceClassification,
                AutoModelForSpeechSeqaSeq,
                AutoModelForTableQuestionAnswering,
                AutoModelForTextEncoding,
                AutoModelForTokenClassification,
                AutoModelForUniversalSegmentation,
                AutoModelForVideoClassification,
                AutoModelForVisionaSeq,
                AutoModelForVisualQuestionAnswering,
                AutoModelForZeroShotImageClassification,
                AutoModelForZeroShotObjectDetection,
                AutoModelWithLMHead,
            )

      try:
            if not is_tf_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_tf_auto import (
                TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING,
                TF_MODEL_FOR_CAUSAL_LM_MAPPING,
                TF_MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING,
                TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING,
                TF_MODEL_FOR_MASK_GENERATION_MAPPING,
                TF_MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING,
                TF_MODEL_FOR_MASKED_LM_MAPPING,
                TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING,
                TF_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING,
                TF_MODEL_FOR_PRETRAINING_MAPPING,
                TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING,
                TF_MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING,
                TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
                TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
                TF_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING,
                TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING,
                TF_MODEL_FOR_TEXT_ENCODING_MAPPING,
                TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING,
                TF_MODEL_FOR_VISION_2_SEQ_MAPPING,
                TF_MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING,
                TF_MODEL_MAPPING,
                TF_MODEL_WITH_LM_HEAD_MAPPING,
                TFAutoModel,
                TFAutoModelForAudioClassification,
                TFAutoModelForCausalLM,
                TFAutoModelForDocumentQuestionAnswering,
                TFAutoModelForImageClassification,
                TFAutoModelForMaskedImageModeling,
                TFAutoModelForMaskedLM,
                TFAutoModelForMaskGeneration,
                TFAutoModelForMultipleChoice,
                TFAutoModelForNextSentencePrediction,
                TFAutoModelForPreTraining,
                TFAutoModelForQuestionAnswering,
                TFAutoModelForSemanticSegmentation,
                TFAutoModelForSeqaSeqLM,
                TFAutoModelForSequenceClassification,
                TFAutoModelForSpeechSeqaSeq,
                TFAutoModelForTableQuestionAnswering,
                TFAutoModelForTextEncoding,
                TFAutoModelForTokenClassification,
                TFAutoModelForVisionaSeq,
                TFAutoModelForZeroShotImageClassification,
                TFAutoModelWithLMHead,
            )

      try:
            if not is_flax_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_flax_auto import (
                FLAX_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING,
                FLAX_MODEL_FOR_CAUSAL_LM_MAPPING,
                FLAX_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING,
                FLAX_MODEL_FOR_MASKED_LM_MAPPING,
                FLAX_MODEL_FOR_MULTIPLE_CHOICE_MAPPING,
                FLAX_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING,
                FLAX_MODEL_FOR_PRETRAINING_MAPPING,
                FLAX_MODEL_FOR_QUESTION_ANSWERING_MAPPING,
                FLAX_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
                FLAX_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
                FLAX_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING,
                FLAX_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING,
                FLAX_MODEL_FOR_VISION_2_SEQ_MAPPING,
                FLAX_MODEL_MAPPING,
                FlaxAutoModel,
                FlaxAutoModelForCausalLM,
                FlaxAutoModelForImageClassification,
                FlaxAutoModelForMaskedLM,
                FlaxAutoModelForMultipleChoice,
                FlaxAutoModelForNextSentencePrediction,
                FlaxAutoModelForPreTraining,
                FlaxAutoModelForQuestionAnswering,
                FlaxAutoModelForSeqaSeqLM,
                FlaxAutoModelForSequenceClassification,
                FlaxAutoModelForSpeechSeqaSeq,
                FlaxAutoModelForTokenClassification,
                FlaxAutoModelForVisionaSeq,
            )

else:
      import sys

      UpperCamelCase_									=   _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





from ...configuration_utils import PretrainedConfig
from ...utils import is_detectrona_available, logging


UpperCamelCase_									=   logging.get_logger(__name__)

UpperCamelCase_									=   {
    '''layoutlmv2-base-uncased''': '''https://huggingface.co/microsoft/layoutlmv2-base-uncased/resolve/main/config.json''',
    '''layoutlmv2-large-uncased''': '''https://huggingface.co/microsoft/layoutlmv2-large-uncased/resolve/main/config.json''',
    # See all LayoutLMv2 models at https://huggingface.co/models?filter=layoutlmv2
}

# soft dependency
if is_detectrona_available():
      import detectrona







class       _snake_case				(     __snake_case ):






   '''simple docstring'''






   A__      : List[Any]       =						"layoutlmv2"


   def __init__(    self:     Tuple  ,lowerCamelCase_:     Dict=30522  ,lowerCamelCase_:     str=768  ,lowerCamelCase_:     Any=12  ,lowerCamelCase_:     Tuple=12  ,lowerCamelCase_:     int=3072  ,lowerCamelCase_:     int="gelu"  ,lowerCamelCase_:     Dict=0.1  ,lowerCamelCase_:     List[Any]=0.1  ,lowerCamelCase_:     List[Any]=512  ,lowerCamelCase_:     Tuple=2  ,lowerCamelCase_:     Dict=0.0_2  ,lowerCamelCase_:     Dict=1e-12  ,lowerCamelCase_:     Dict=0  ,lowerCamelCase_:     List[str]=1024  ,lowerCamelCase_:     Optional[Any]=128  ,lowerCamelCase_:     List[Any]=32  ,lowerCamelCase_:     List[Any]=True  ,lowerCamelCase_:     Dict=256  ,lowerCamelCase_:     int=64  ,lowerCamelCase_:     str=True  ,lowerCamelCase_:     Tuple=[7, 7, 256]  ,lowerCamelCase_:     Union[str, Any]=128  ,lowerCamelCase_:     Any=128  ,lowerCamelCase_:     int=True  ,lowerCamelCase_:     Union[str, Any]=True  ,lowerCamelCase_:     Optional[int]=False  ,lowerCamelCase_:     List[str]=None  ,**lowerCamelCase_:     str  ,)	->      Any:
       super().__init__(
           vocab_size=lowerCamelCase_  ,hidden_size=lowerCamelCase_  ,num_hidden_layers=lowerCamelCase_  ,num_attention_heads=lowerCamelCase_  ,intermediate_size=lowerCamelCase_  ,hidden_act=lowerCamelCase_  ,hidden_dropout_prob=lowerCamelCase_  ,attention_probs_dropout_prob=lowerCamelCase_  ,max_position_embeddings=lowerCamelCase_  ,type_vocab_size=lowerCamelCase_  ,initializer_range=lowerCamelCase_  ,layer_norm_eps=lowerCamelCase_  ,pad_token_id=lowerCamelCase_  ,**lowerCamelCase_  ,)
       UpperCAmelCase_     :       Optional[int]  		=					max_ad_position_embeddings
       UpperCAmelCase_     :       Optional[int]  		=					max_rel_pos
       UpperCAmelCase_     :       Optional[int]  		=					rel_pos_bins
       UpperCAmelCase_     :       List[str]  		=					fast_qkv
       UpperCAmelCase_     :       int  		=					max_rel_ad_pos
       UpperCAmelCase_     :       int  		=					rel_ad_pos_bins
       UpperCAmelCase_     :       Optional[Any]  		=					convert_sync_batchnorm
       UpperCAmelCase_     :       str  		=					image_feature_pool_shape
       UpperCAmelCase_     :       List[Any]  		=					coordinate_size
       UpperCAmelCase_     :       int  		=					shape_size
       UpperCAmelCase_     :       Optional[Any]  		=					has_relative_attention_bias
       UpperCAmelCase_     :       str  		=					has_spatial_attention_bias
       UpperCAmelCase_     :       Tuple  		=					has_visual_segment_embedding
       UpperCAmelCase_     :       Optional[Any]  		=					(
           detectrona_config_args if detectrona_config_args is not None else self.get_default_detectrona_config()
       )


   @classmethod
   def       A__    (    self:     Any							)	->      Dict:
       return {
           "MODEL.MASK_ON": True,
           "MODEL.PIXEL_STD": [5_7.3_7_5, 5_7.1_2_0, 5_8.3_9_5],
           "MODEL.BACKBONE.NAME": "build_resnet_fpn_backbone",
           "MODEL.FPN.IN_FEATURES": ["res2", "res3", "res4", "res5"],
           "MODEL.ANCHOR_GENERATOR.SIZES": [[32], [64], [128], [256], [512]],
           "MODEL.RPN.IN_FEATURES": ["p2", "p3", "p4", "p5", "p6"],
           "MODEL.RPN.PRE_NMS_TOPK_TRAIN": 2000,
           "MODEL.RPN.PRE_NMS_TOPK_TEST": 1000,
           "MODEL.RPN.POST_NMS_TOPK_TRAIN": 1000,
           "MODEL.POST_NMS_TOPK_TEST": 1000,
           "MODEL.ROI_HEADS.NAME": "StandardROIHeads",
           "MODEL.ROI_HEADS.NUM_CLASSES": 5,
           "MODEL.ROI_HEADS.IN_FEATURES": ["p2", "p3", "p4", "p5"],
           "MODEL.ROI_BOX_HEAD.NAME": "FastRCNNConvFCHead",
           "MODEL.ROI_BOX_HEAD.NUM_FC": 2,
           "MODEL.ROI_BOX_HEAD.POOLER_RESOLUTION": 14,
           "MODEL.ROI_MASK_HEAD.NAME": "MaskRCNNConvUpsampleHead",
           "MODEL.ROI_MASK_HEAD.NUM_CONV": 4,
           "MODEL.ROI_MASK_HEAD.POOLER_RESOLUTION": 7,
           "MODEL.RESNETS.DEPTH": 101,
           "MODEL.RESNETS.SIZES": [[32], [64], [128], [256], [512]],
           "MODEL.RESNETS.ASPECT_RATIOS": [[0.5, 1.0, 2.0]],
           "MODEL.RESNETS.OUT_FEATURES": ["res2", "res3", "res4", "res5"],
           "MODEL.RESNETS.NUM_GROUPS": 32,
           "MODEL.RESNETS.WIDTH_PER_GROUP": 8,
           "MODEL.RESNETS.STRIDE_IN_1X1": False,
       }






   def       A__    (    self:     Tuple							)	->      int:
       UpperCAmelCase_     :       Any  		=					detectrona.config.get_cfg()
       for k, v in self.detectrona_config_args.items():
           UpperCAmelCase_     :       Optional[int]  		=					k.split("""."""							)
           UpperCAmelCase_     :       List[str]  		=					detectrona_config
           for attribute in attributes[:-1]:
               UpperCAmelCase_     :       Optional[Any]  		=					getattr(lowerCamelCase_  ,lowerCamelCase_							)
           setattr(lowerCamelCase_  ,attributes[-1]  ,lowerCamelCase_							)

       return detectrona_config
