




"""simple docstring"""





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


_lowercase						   =     logging.get_logger(__name__)

_lowercase						   =     {
    """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    __lowercase							(      A_						):


				'''simple docstring'''


				_lowerCAmelCase						      ="layoutlmv2"

				def __init__( self :  List[Any]   ,SCREAMING_SNAKE_CASE_ :  Optional[int]=3_0_5_2_2   ,SCREAMING_SNAKE_CASE_ :  Optional[Any]=7_6_8   ,SCREAMING_SNAKE_CASE_ :  Any=1_2   ,SCREAMING_SNAKE_CASE_ :  List[Any]=1_2   ,SCREAMING_SNAKE_CASE_ :  Dict=3_0_7_2   ,SCREAMING_SNAKE_CASE_ :  Dict="gelu"   ,SCREAMING_SNAKE_CASE_ :  Any=0.1   ,SCREAMING_SNAKE_CASE_ :  Optional[int]=0.1   ,SCREAMING_SNAKE_CASE_ :  str=5_1_2   ,SCREAMING_SNAKE_CASE_ :  int=2   ,SCREAMING_SNAKE_CASE_ :  Any=0.02   ,SCREAMING_SNAKE_CASE_ :  Dict=1E-12   ,SCREAMING_SNAKE_CASE_ :  Dict=0   ,SCREAMING_SNAKE_CASE_ :  str=1_0_2_4   ,SCREAMING_SNAKE_CASE_ :  Tuple=1_2_8   ,SCREAMING_SNAKE_CASE_ :  Optional[int]=3_2   ,SCREAMING_SNAKE_CASE_ :  int=True   ,SCREAMING_SNAKE_CASE_ :  Dict=2_5_6   ,SCREAMING_SNAKE_CASE_ :  Tuple=6_4   ,SCREAMING_SNAKE_CASE_ :  List[Any]=True   ,SCREAMING_SNAKE_CASE_ :  Tuple=[7, 7, 2_5_6]   ,SCREAMING_SNAKE_CASE_ :  Tuple=1_2_8   ,SCREAMING_SNAKE_CASE_ :  List[str]=1_2_8   ,SCREAMING_SNAKE_CASE_ :  List[Any]=True   ,SCREAMING_SNAKE_CASE_ :  Any=True   ,SCREAMING_SNAKE_CASE_ :  Union[str, Any]=False   ,SCREAMING_SNAKE_CASE_ :  Any=None   ,**SCREAMING_SNAKE_CASE_ :  Any   ,):
										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   ,)
										snake_case__							:       Any				      =       max_ad_position_embeddings
										snake_case__							:       int				      =       max_rel_pos
										snake_case__							:       Dict				      =       rel_pos_bins
										snake_case__							:       Dict				      =       fast_qkv
										snake_case__							:       Union[str, Any]				      =       max_rel_ad_pos
										snake_case__							:       List[Any]				      =       rel_ad_pos_bins
										snake_case__							:       Dict				      =       convert_sync_batchnorm
										snake_case__							:       Optional[int]				      =       image_feature_pool_shape
										snake_case__							:       Union[str, Any]				      =       coordinate_size
										snake_case__							:       List[str]				      =       shape_size
										snake_case__							:       Tuple				      =       has_relative_attention_bias
										snake_case__							:       Union[str, Any]				      =       has_spatial_attention_bias
										snake_case__							:       List[str]				      =       has_visual_segment_embedding
										snake_case__							:       Optional[int]				      =       (
										    detectrona_config_args if detectrona_config_args is not None else self.get_default_detectrona_config()
										)

				@classmethod
				def    _lowerCamelCase       ( self :  Optional[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 :  Any   ):
										snake_case__							:       List[str]				      =       detectrona.config.get_cfg()
										for k, v in self.detectrona_config_args.items():
																snake_case__							:       int				      =       k.split('''.'''   )
																snake_case__							:       str				      =       detectrona_config
																for attribute in attributes[:-1]:
																						snake_case__							:       List[str]				      =       getattr(_A   ,_A   )
																setattr(_A   ,attributes[-1]   ,_A   )

										return detectrona_config




_A       =					{
    "0": 1,
    "1": 1,
    "2": 2,
    "3": 6,
    "4": 24,
    "5": 1_20,
    "6": 7_20,
    "7": 50_40,
    "8": 4_03_20,
    "9": 36_28_80,
}

_A       =					{1_45: 1_45}

_A       =					{
    1_45: 0,
    1_69: 3,
    3_63_01: 3,
    14_54: 3,
    8_71: 2,
    4_53_61: 2,
    8_72: 2,
}



def 		lowercase_     (  A__						)				->				int:
    """simple docstring"""

    if n in CACHE_SUM_DIGIT_FACTORIALS:
        return CACHE_SUM_DIGIT_FACTORIALS[n]
    snake_case						=   sum(DIGIT_FACTORIALS[let] for let in str(A__						)						)
    snake_case						=   ret
    return ret



def 		lowercase_     (  A__					,						A__ = None						)				->				int:
    """simple docstring"""

    snake_case						=   previous or set()
    if n in CHAIN_LENGTH_CACHE:
        return CHAIN_LENGTH_CACHE[n]
    snake_case						=   sum_digit_factorials(A__						)
    if next_number in previous:
        snake_case						=   0
        return 0
    else:
        previous.add(A__						)
        snake_case						=   1 + chain_length(A__					,						A__						)
        snake_case						=   ret
        return ret



def 		lowercase_     (  A__ = 60					,						A__ = 100_0000						)				->				int:
    """simple docstring"""

    return sum(1 for i in range(1					,						A__						) if chain_length(A__						) == num_terms						)


if __name__ == "__main__":
   print(f"{solution() = }")

