code: 
  '''simple docstring'''
  
  from ...configuration_utils import PretrainedConfig
  from ...utils import is_detectrona_available, logging
  
  
  _UpperCAmelCase   :      Any 						=  logging.get_logger(__name__)
  
  _UpperCAmelCase   :      Tuple 						=  {
      '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 			UpperCAmelCase				(					A__ ):
  
  
  
  
  
  		"""simple docstring"""
  
  
  
  
  
  		A__  :   Optional[Any]          =    'layoutlmv2'
  		def __init__(    self  ,					_snake_case=30522  ,					_snake_case=768  ,					_snake_case=12  ,					_snake_case=12  ,					_snake_case=3072  ,					_snake_case="gelu"  ,					_snake_case=0.1  ,					_snake_case=0.1  ,					_snake_case=512  ,					_snake_case=2  ,					_snake_case=0.02  ,					_snake_case=1E-12  ,					_snake_case=0  ,					_snake_case=1024  ,					_snake_case=128  ,					_snake_case=32  ,					_snake_case=True  ,					_snake_case=256  ,					_snake_case=64  ,					_snake_case=True  ,					_snake_case=[7, 7, 256]  ,					_snake_case=128  ,					_snake_case=128  ,					_snake_case=True  ,					_snake_case=True  ,					_snake_case=False  ,					_snake_case=None  ,					**_snake_case  ,					)				->    Dict:
  				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       : str    =      max_ad_position_embeddings
  				_UpperCamelCase       : Any    =      max_rel_pos
  				_UpperCamelCase       : Union[str, Any]    =      rel_pos_bins
  				_UpperCamelCase       : Tuple    =      fast_qkv
  				_UpperCamelCase       : List[Any]    =      max_rel_ad_pos
  				_UpperCamelCase       : Optional[int]    =      rel_ad_pos_bins
  				_UpperCamelCase       : List[Any]    =      convert_sync_batchnorm
  				_UpperCamelCase       : Union[str, Any]    =      image_feature_pool_shape
  				_UpperCamelCase       : int    =      coordinate_size
  				_UpperCamelCase       : Optional[int]    =      shape_size
  				_UpperCamelCase       : List[str]    =      has_relative_attention_bias
  				_UpperCamelCase       : List[Any]    =      has_spatial_attention_bias
  				_UpperCamelCase       : str    =      has_visual_segment_embedding
  				_UpperCamelCase       : Union[str, Any]    =      (
  				    detectrona_config_args if detectrona_config_args is not None else self.get_default_detectrona_config()
  				)
  		@classmethod
  		def _lowercase  (    self     )				->    int:
  				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], [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 _lowercase  (    self     )				->    Any:
  				_UpperCamelCase       : List[str]    =      detectrona.config.get_cfg()
  				for k, v in self.detectrona_config_args.items():
  						_UpperCamelCase       : int    =      k.split('''.'''     )
  						_UpperCamelCase       : List[str]    =      detectrona_config
  						for attribute in attributes[:-1]:
  								_UpperCamelCase       : int    =      getattr(_lowerCAmelCase  ,					_lowerCAmelCase     )
  						setattr(_lowerCAmelCase  ,					attributes[-1]  ,					_lowerCAmelCase     )
  
  				return detectrona_config
  
  
  
  
style_context: 
  '''simple docstring'''
  
  _UpperCAmelCase   :      Optional[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
  """
  
  _UpperCAmelCase   :      Union[str, Any] 						=  [{"""type""": """code""", """content""": INSTALL_CONTENT}]
  _UpperCAmelCase   :      Union[str, Any] 						=  {
      """{processor_class}""": """FakeProcessorClass""",
      """{model_class}""": """FakeModelClass""",
      """{object_class}""": """FakeObjectClass""",
  }
  
  
  
  
  
  