

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


_SCREAMING_SNAKE_CASE          = logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE          = {
    '''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     lowerCamelCase_   ( _lowerCAmelCase):
 _lowerCAmelCase       		=  '''layoutlmv2'''




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




 @classmethod
 def 						a					( self       ):
   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": 2_000,
       "MODEL.RPN.PRE_NMS_TOPK_TEST": 1_000,
       "MODEL.RPN.POST_NMS_TOPK_TRAIN": 1_000,
       "MODEL.POST_NMS_TOPK_TEST": 1_000,
       "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       ):
   __UpperCAmelCase  :     Tuple		=    detectrona.config.get_cfg()
   for k, v in self.detectrona_config_args.items():
     __UpperCAmelCase  :     List[Any]		=    k.split('.'       )
     __UpperCAmelCase  :     int		=    detectrona_config
     for attribute in attributes[:-1]:
       __UpperCAmelCase  :     List[Any]		=    getattr(_UpperCAmelCase     ,     _UpperCAmelCase       )
     setattr(_UpperCAmelCase     ,     attributes[-1]     ,     _UpperCAmelCase       )

   return detectrona_config








import math
from itertools import permutations





def    _snake_case		(snake_case_				:    int     )       ->		bool:

  if 1 < number < 4:
    # 2 and 3 are primes
    return True
  elif number < 2 or number % 2 == 0 or number % 3 == 0:
    # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
    return False

  # All primes number are in format of 6k +/- 1
  for i in range(5						,					int(math.sqrt(snake_case_     ) + 1     )						,					6     ):
    if number % i == 0 or number % (i + 2) == 0:
      return False
  return True





def    _snake_case		(snake_case_				:    int						,					snake_case_				:    list     )       ->		bool:
  __UpperCAmelCase, __UpperCAmelCase  :     Any		=    0, len(snake_case_     ) - 1
  while left <= right:
    __UpperCAmelCase  :     List[str]		=    (left + right) // 2
    if prime_list[middle] == target:
      return True
    elif prime_list[middle] < target:
      __UpperCAmelCase  :     Tuple		=    middle + 1
    else:
      __UpperCAmelCase  :     Tuple		=    middle - 1

  return False





def    _snake_case		()       ->		str:
  __UpperCAmelCase  :     List[Any]		=    [n for n in range(1001						,					1_0000						,					2     ) if is_prime(snake_case_     )]
  __UpperCAmelCase  :     Tuple		=    []

  for number in prime_list:
    __UpperCAmelCase  :     List[str]		=    []

    for prime_member in permutations(list(str(snake_case_     )     )     ):
      __UpperCAmelCase  :     Dict		=    int(''.join(snake_case_     )     )

      if prime % 2 == 0:
        continue

      if search(snake_case_						,					snake_case_     ):
        tmp_numbers.append(snake_case_     )

    tmp_numbers.sort()
    if len(snake_case_     ) >= 3:
      candidates.append(snake_case_     )

  __UpperCAmelCase  :     Optional[int]		=    []
  for candidate in candidates:
    __UpperCAmelCase  :     int		=    len(snake_case_     )
    __UpperCAmelCase  :     List[Any]		=    False

    for i in range(snake_case_     ):
      for j in range(i + 1						,					snake_case_     ):
        for k in range(j + 1						,					snake_case_     ):
          if (
              abs(candidate[i] - candidate[j]     )
              == abs(candidate[j] - candidate[k]     )
              and len({candidate[i], candidate[j], candidate[k]}     ) == 3
          ):
            passed.append(
                sorted([candidate[i], candidate[j], candidate[k]]     )     )
            __UpperCAmelCase  :     Any		=    True

          if found:
            break
        if found:
          break
      if found:
        break

  __UpperCAmelCase  :     Dict		=    set()
  for seq in passed:
    answer.add(''.join([str(snake_case_     ) for i in seq]     )     )

  return max(int(snake_case_     ) for x in answer     )


if __name__ == "__main__":
      print(solution())





