




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


__magic_name__     :     List[Any]  							=					logging.get_logger(__name__)

__magic_name__     :     List[str]  							=					{
    """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 						SCREAMING_SNAKE_CASE__		(_a ):
     lowercase_   :			int   =   "layoutlmv2"
     def __init__(	self  :		List[Any]					,	__lowerCamelCase  :		Union[str, Any]=3_05_22					,	__lowerCamelCase  :		List[Any]=7_68					,	__lowerCamelCase  :		Tuple=12					,	__lowerCamelCase  :		Union[str, Any]=12					,	__lowerCamelCase  :		List[Any]=30_72					,	__lowerCamelCase  :		Union[str, Any]="gelu"					,	__lowerCamelCase  :		Dict=0.1					,	__lowerCamelCase  :		str=0.1					,	__lowerCamelCase  :		Optional[Any]=5_12					,	__lowerCamelCase  :		Union[str, Any]=2					,	__lowerCamelCase  :		List[str]=0.02					,	__lowerCamelCase  :		int=1e-12					,	__lowerCamelCase  :		Dict=0					,	__lowerCamelCase  :		str=10_24					,	__lowerCamelCase  :		Dict=1_28					,	__lowerCamelCase  :		Tuple=32					,	__lowerCamelCase  :		Optional[Any]=True					,	__lowerCamelCase  :		List[Any]=2_56					,	__lowerCamelCase  :		List[str]=64					,	__lowerCamelCase  :		Union[str, Any]=True					,	__lowerCamelCase  :		str=[7, 7, 2_56]					,	__lowerCamelCase  :		Tuple=1_28					,	__lowerCamelCase  :		Optional[int]=1_28					,	__lowerCamelCase  :		Union[str, Any]=True					,	__lowerCamelCase  :		str=True					,	__lowerCamelCase  :		List[Any]=False					,	__lowerCamelCase  :		Tuple=None					,	**__lowerCamelCase  :		Optional[Any]					,	):



       """simple docstring"""
       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					,	)
       lowerCAmelCase__								=			max_ad_position_embeddings
       lowerCAmelCase__								=			max_rel_pos
       lowerCAmelCase__								=			rel_pos_bins
       lowerCAmelCase__								=			fast_qkv
       lowerCAmelCase__								=			max_rel_ad_pos
       lowerCAmelCase__								=			rel_ad_pos_bins
       lowerCAmelCase__								=			convert_sync_batchnorm
       lowerCAmelCase__								=			image_feature_pool_shape
       lowerCAmelCase__								=			coordinate_size
       lowerCAmelCase__								=			shape_size
       lowerCAmelCase__								=			has_relative_attention_bias
       lowerCAmelCase__								=			has_spatial_attention_bias
       lowerCAmelCase__								=			has_visual_segment_embedding
       lowerCAmelCase__								=			(
           detectrona_config_args if detectrona_config_args is not None else self.get_default_detectrona_config()
       )
     @classmethod
     def 					A__			(	self  :		List[Any]	):



       """simple docstring"""
       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": [[32], [64], [1_28], [2_56], [5_12]],
           "MODEL.RPN.IN_FEATURES": ["p2", "p3", "p4", "p5", "p6"],
           "MODEL.RPN.PRE_NMS_TOPK_TRAIN": 20_00,
           "MODEL.RPN.PRE_NMS_TOPK_TEST": 10_00,
           "MODEL.RPN.POST_NMS_TOPK_TRAIN": 10_00,
           "MODEL.POST_NMS_TOPK_TEST": 10_00,
           "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": 1_01,
           "MODEL.RESNETS.SIZES": [[32], [64], [1_28], [2_56], [5_12]],
           "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  :		Any	):



       """simple docstring"""
       lowerCAmelCase__								=			detectrona.config.get_cfg()
       for k, v in self.detectrona_config_args.items():
         lowerCAmelCase__								=			k.split('''.'''	)
         lowerCAmelCase__								=			detectrona_config
         for attribute in attributes[:-1]:
           lowerCAmelCase__								=			getattr(__lowerCamelCase					,	__lowerCamelCase	)
         setattr(__lowerCamelCase					,	attributes[-1]					,	__lowerCamelCase	)

       return detectrona_config







def 		a_       (   __lowerCAmelCase      ,   __lowerCAmelCase							):
  assert isinstance(__lowerCAmelCase      ,   __lowerCAmelCase							), F"""The input value of [set_a={set_a}] is not a set"""
  assert isinstance(__lowerCAmelCase      ,   __lowerCAmelCase							), F"""The input value of [set_b={set_b}] is not a set"""

  return {a + b for a in set_a for b in set_b}


if __name__ == "__main__":
      from doctest import testmod

      testmod()

