





'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import is_detectrona_available, logging


a__							:							Tuple			=logging.get_logger(__name__)

a__							:							List[Any]			={
    '''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					(   __lowerCamelCase	):




 """simple docstring"""



 SCREAMING_SNAKE_CASE_     : Any      		="layoutlmv2"






 def __init__(	self	:							Optional[int]							,     __A	:							str=3_0_5_2_2							,     __A	:							List[str]=7_6_8							,     __A	:							Dict=1_2							,     __A	:							Any=1_2							,     __A	:							List[str]=3_0_7_2							,     __A	:							List[str]="gelu"							,     __A	:							Union[str, Any]=0.1							,     __A	:							Tuple=0.1							,     __A	:							Optional[Any]=5_1_2							,     __A	:							List[Any]=2							,     __A	:							Tuple=0.02							,     __A	:							Dict=1e-12							,     __A	:							Optional[int]=0							,     __A	:							Optional[Any]=1_0_2_4							,     __A	:							List[Any]=1_2_8							,     __A	:							List[str]=3_2							,     __A	:							List[Any]=True							,     __A	:							List[Any]=2_5_6							,     __A	:							List[Any]=6_4							,     __A	:							Union[str, Any]=True							,     __A	:							str=[7, 7, 2_5_6]							,     __A	:							Union[str, Any]=1_2_8							,     __A	:							Any=1_2_8							,     __A	:							List[Any]=True							,     __A	:							Union[str, Any]=True							,     __A	:							int=False							,     __A	:							Any=None							,     **__A	:							List[str]							,     ):
        super().__init__(
            vocab_size=__A							,     hidden_size=__A							,     num_hidden_layers=__A							,     num_attention_heads=__A							,     intermediate_size=__A							,     hidden_act=__A							,     hidden_dropout_prob=__A							,     attention_probs_dropout_prob=__A							,     max_position_embeddings=__A							,     type_vocab_size=__A							,     initializer_range=__A							,     layer_norm_eps=__A							,     pad_token_id=__A							,     **__A							,     )
        __UpperCamelCase	=  max_ad_position_embeddings
        __UpperCamelCase	=  max_rel_pos
        __UpperCamelCase	=  rel_pos_bins
        __UpperCamelCase	=  fast_qkv
        __UpperCamelCase	=  max_rel_ad_pos
        __UpperCamelCase	=  rel_ad_pos_bins
        __UpperCamelCase	=  convert_sync_batchnorm
        __UpperCamelCase	=  image_feature_pool_shape
        __UpperCamelCase	=  coordinate_size
        __UpperCamelCase	=  shape_size
        __UpperCamelCase	=  has_relative_attention_bias
        __UpperCamelCase	=  has_spatial_attention_bias
        __UpperCamelCase	=  has_visual_segment_embedding
        __UpperCamelCase	=  (
            detectrona_config_args if detectrona_config_args is not None else self.get_default_detectrona_config()
        )






 @classmethod
 def 	_lowerCamelCase (	self	:							List[Any]     ):
        return {
            "MODEL.MASK_ON": True,
            "MODEL.PIXEL_STD": [57.375, 57.120, 58.395],
            "MODEL.BACKBONE.NAME": "build_resnet_fpn_backbone",
            "MODEL.FPN.IN_FEATURES": ["res2", "res3", "res4", "res5"],
            "MODEL.ANCHOR_GENERATOR.SIZES": [[3_2], [6_4], [1_2_8], [2_5_6], [5_1_2]],
            "MODEL.RPN.IN_FEATURES": ["p2", "p3", "p4", "p5", "p6"],
            "MODEL.RPN.PRE_NMS_TOPK_TRAIN": 2_0_0_0,
            "MODEL.RPN.PRE_NMS_TOPK_TEST": 1_0_0_0,
            "MODEL.RPN.POST_NMS_TOPK_TRAIN": 1_0_0_0,
            "MODEL.POST_NMS_TOPK_TEST": 1_0_0_0,
            "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": 1_4,
            "MODEL.ROI_MASK_HEAD.NAME": "MaskRCNNConvUpsampleHead",
            "MODEL.ROI_MASK_HEAD.NUM_CONV": 4,
            "MODEL.ROI_MASK_HEAD.POOLER_RESOLUTION": 7,
            "MODEL.RESNETS.DEPTH": 1_0_1,
            "MODEL.RESNETS.SIZES": [[3_2], [6_4], [1_2_8], [2_5_6], [5_1_2]],
            "MODEL.RESNETS.ASPECT_RATIOS": [[0.5, 1.0, 2.0]],
            "MODEL.RESNETS.OUT_FEATURES": ["res2", "res3", "res4", "res5"],
            "MODEL.RESNETS.NUM_GROUPS": 3_2,
            "MODEL.RESNETS.WIDTH_PER_GROUP": 8,
            "MODEL.RESNETS.STRIDE_IN_1X1": False,
        }






 def 	_lowerCamelCase (	self	:							Union[str, Any]     ):
        __UpperCamelCase	=  detectrona.config.get_cfg()
        for k, v in self.detectrona_config_args.items():
               __UpperCamelCase	=  k.split('.'     )
               __UpperCamelCase	=  detectrona_config
               for attribute in attributes[:-1]:
                      __UpperCamelCase	=  getattr(__A							,     __A     )
               setattr(__A							,     attributes[-1]							,     __A     )

        return detectrona_config







'''simple docstring'''
a__							:							int			='''
# Transformers installation
! pip install transformers datasets evaluate
# To install from source instead of the last release, comment the command above and uncomment the following one.
# ! pip install git+https://github.com/huggingface/transformers.git
'''

a__							:							List[Any]			=[{'''type''': '''code''', '''content''': INSTALL_CONTENT}]
a__							:							Dict			={
    '''{processor_class}''': '''FakeProcessorClass''',
    '''{model_class}''': '''FakeModelClass''',
    '''{object_class}''': '''FakeObjectClass''',
}
