






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


lowerCamelCase										=  logging.get_logger(__name__)

lowerCamelCase										=  {
    '''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_							(       lowercase_      ):







   """simple docstring"""



   __lowerCAmelCase      =						"""layoutlmv2"""

   def __init__(    self:	int   ,       snake_case__:	List[Any]=30_522   ,       snake_case__:	Optional[int]=768   ,       snake_case__:	Union[str, Any]=12   ,       snake_case__:	Union[str, Any]=12   ,       snake_case__:	Optional[int]=3_072   ,       snake_case__:	Optional[int]="gelu"   ,       snake_case__:	Optional[Any]=0.1   ,       snake_case__:	List[str]=0.1   ,       snake_case__:	str=512   ,       snake_case__:	str=2   ,       snake_case__:	str=0.02   ,       snake_case__:	str=1E-12   ,       snake_case__:	str=0   ,       snake_case__:	List[str]=1_024   ,       snake_case__:	Any=128   ,       snake_case__:	Any=32   ,       snake_case__:	List[Any]=True   ,       snake_case__:	int=256   ,       snake_case__:	Tuple=64   ,       snake_case__:	Optional[int]=True   ,       snake_case__:	Union[str, Any]=[7, 7, 256]   ,       snake_case__:	Dict=128   ,       snake_case__:	int=128   ,       snake_case__:	Any=True   ,       snake_case__:	Any=True   ,       snake_case__:	Tuple=False   ,       snake_case__:	Optional[Any]=None   ,       **snake_case__:	str   ,       )  ->		Any:


       """simple docstring"""



       super().__init__(
           vocab_size=snake_case__   ,       hidden_size=snake_case__   ,       num_hidden_layers=snake_case__   ,       num_attention_heads=snake_case__   ,       intermediate_size=snake_case__   ,       hidden_act=snake_case__   ,       hidden_dropout_prob=snake_case__   ,       attention_probs_dropout_prob=snake_case__   ,       max_position_embeddings=snake_case__   ,       type_vocab_size=snake_case__   ,       initializer_range=snake_case__   ,       layer_norm_eps=snake_case__   ,       pad_token_id=snake_case__   ,       **snake_case__   ,       )
       _lowercase     =	max_ad_position_embeddings
       _lowercase     =	max_rel_pos
       _lowercase     =	rel_pos_bins
       _lowercase     =	fast_qkv
       _lowercase     =	max_rel_ad_pos
       _lowercase     =	rel_ad_pos_bins
       _lowercase     =	convert_sync_batchnorm
       _lowercase     =	image_feature_pool_shape
       _lowercase     =	coordinate_size
       _lowercase     =	shape_size
       _lowercase     =	has_relative_attention_bias
       _lowercase     =	has_spatial_attention_bias
       _lowercase     =	has_visual_segment_embedding
       _lowercase     =	(
           detectrona_config_args if detectrona_config_args is not None else self.get_default_detectrona_config()
       )

   @classmethod
   def 			SCREAMING_SNAKE_CASE__				(    self:	Tuple	)  ->		Any:


       """simple docstring"""



       return {
           "MODEL.MASK_ON": True,
           "MODEL.PIXEL_STD": [57.3_75, 57.1_20, 58.3_95],
           "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 			SCREAMING_SNAKE_CASE__				(    self:	List[Any]	)  ->		List[str]:


       """simple docstring"""



       _lowercase     =	detectrona.config.get_cfg()
       for k, v in self.detectrona_config_args.items():
           _lowercase     =	k.split('.'	)
           _lowercase     =	detectrona_config
           for attribute in attributes[:-1]:
               _lowercase     =	getattr(snake_case__   ,       snake_case__	)
           setattr(snake_case__   ,       attributes[-1]   ,       snake_case__	)

       return detectrona_config








from typing import List, Union

from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase										=  logging.get_logger(__name__)

lowerCamelCase										=  {
    '''allenai/led-base-16384''': '''https://huggingface.co/allenai/led-base-16384/resolve/main/config.json''',
    # See all LED models at https://huggingface.co/models?filter=led
}

class 					snake_case_							(       lowercase_      ):







   """simple docstring"""



   __lowerCAmelCase      =						"""led"""
   __lowerCAmelCase      =						{
       """num_attention_heads""": """encoder_attention_heads""",
       """hidden_size""": """d_model""",
       """attention_probs_dropout_prob""": """attention_dropout""",
       """initializer_range""": """init_std""",
   }

   def __init__(    self:	int   ,       snake_case__:	str=50_265   ,       snake_case__:	Dict=16_384   ,       snake_case__:	str=1_024   ,       snake_case__:	Tuple=12   ,       snake_case__:	int=4_096   ,       snake_case__:	Union[str, Any]=16   ,       snake_case__:	int=12   ,       snake_case__:	Union[str, Any]=4_096   ,       snake_case__:	Optional[Any]=16   ,       snake_case__:	str=0.0   ,       snake_case__:	Optional[Any]=0.0   ,       snake_case__:	List[Any]=True   ,       snake_case__:	List[Any]=True   ,       snake_case__:	List[Any]="gelu"   ,       snake_case__:	Optional[int]=1_024   ,       snake_case__:	List[Any]=0.1   ,       snake_case__:	int=0.0   ,       snake_case__:	List[str]=0.0   ,       snake_case__:	List[str]=0.02   ,       snake_case__:	Dict=2   ,       snake_case__:	int=0.0   ,       snake_case__:	Optional[int]=1   ,       snake_case__:	Tuple=0   ,       snake_case__:	Union[str, Any]=2   ,       snake_case__:	Union[List[int], int] = 512   ,       **snake_case__:	int   ,       )  ->		List[Any]:


       """simple docstring"""



       _lowercase     =	vocab_size
       _lowercase     =	max_encoder_position_embeddings
       _lowercase     =	max_decoder_position_embeddings
       _lowercase     =	d_model
       _lowercase     =	encoder_ffn_dim
       _lowercase     =	encoder_layers
       _lowercase     =	encoder_attention_heads
       _lowercase     =	decoder_ffn_dim
       _lowercase     =	decoder_layers
       _lowercase     =	decoder_attention_heads
       _lowercase     =	dropout
       _lowercase     =	attention_dropout
       _lowercase     =	activation_dropout
       _lowercase     =	activation_function
       _lowercase     =	init_std
       _lowercase     =	encoder_layerdrop
       _lowercase     =	decoder_layerdrop
       _lowercase     =	classifier_dropout
       _lowercase     =	use_cache
       _lowercase     =	encoder_layers
       _lowercase     =	attention_window

       super().__init__(
           pad_token_id=snake_case__   ,       bos_token_id=snake_case__   ,       eos_token_id=snake_case__   ,       is_encoder_decoder=snake_case__   ,       decoder_start_token_id=snake_case__   ,       **snake_case__   ,       )
