
from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING


lowercase__		:str   =    logging.get_logger(__name__)

lowercase__		:Tuple   =    {
    "microsoft/table-transformer-detection": (
        "https://huggingface.co/microsoft/table-transformer-detection/resolve/main/config.json"
    ),
}







class 				lowercase		(					SCREAMING_SNAKE_CASE__		):
							lowercase_       :       Optional[Any]       					='''table-transformer'''
							lowercase_       :       Optional[Any]       					=['''past_key_values''']
							lowercase_       :       Optional[int]       					={
							    '''hidden_size''': '''d_model''',
							    '''num_attention_heads''': '''encoder_attention_heads''',
							}




							def __init__(				self   ,A__=True   ,A__=None   ,A__=3   ,A__=1_0_0   ,A__=6   ,A__=2_0_4_8   ,A__=8   ,A__=6   ,A__=2_0_4_8   ,A__=8   ,A__=0.0   ,A__=0.0   ,A__=True   ,A__="relu"   ,A__=2_5_6   ,A__=0.1   ,A__=0.0   ,A__=0.0   ,A__=0.02   ,A__=1.0   ,A__=False   ,A__="sine"   ,A__="resnet50"   ,A__=True   ,A__=False   ,A__=1   ,A__=5   ,A__=2   ,A__=1   ,A__=1   ,A__=5   ,A__=2   ,A__=0.1   ,**A__   ,):
												if backbone_config is not None and use_timm_backbone:
																	raise ValueError('''You can\'t specify both `backbone_config` and `use_timm_backbone`.''')

												if not use_timm_backbone:
																	if backbone_config is None:
																						logger.info('''`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.''')
																						lowercase							=						CONFIG_MAPPING['''resnet'''](out_features=['''stage4'''])
																	elif isinstance(A__   ,A__):
																						lowercase							=						backbone_config.get('''model_type''')
																						lowercase							=						CONFIG_MAPPING[backbone_model_type]
																						lowercase							=						config_class.from_dict(A__)
																	# set timm attributes to None
																	lowercase	,						lowercase	,						lowercase							=						None, None, None

												lowercase							=						use_timm_backbone
												lowercase							=						backbone_config
												lowercase							=						num_channels
												lowercase							=						num_queries
												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							=						init_xavier_std
												lowercase							=						encoder_layerdrop
												lowercase							=						decoder_layerdrop
												lowercase							=						encoder_layers
												lowercase							=						auxiliary_loss
												lowercase							=						position_embedding_type
												lowercase							=						backbone
												lowercase							=						use_pretrained_backbone
												lowercase							=						dilation
												# Hungarian matcher
												lowercase							=						class_cost
												lowercase							=						bbox_cost
												lowercase							=						giou_cost
												# Loss coefficients
												lowercase							=						mask_loss_coefficient
												lowercase							=						dice_loss_coefficient
												lowercase							=						bbox_loss_coefficient
												lowercase							=						giou_loss_coefficient
												lowercase							=						eos_coefficient
												super().__init__(is_encoder_decoder=A__   ,**A__)




							@property
							def  A__      (				self):
												return self.encoder_attention_heads





							@property
							def  A__      (				self):
												return self.d_model







class 				lowercase		(					SCREAMING_SNAKE_CASE__		):
							lowercase_       :       List[Any]       					=version.parse('''1.11'''		)




							@property
							def  A__      (				self):
												return OrderedDict(
												    [
												        ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
												        ('''pixel_mask''', {0: '''batch'''}),
												    ])




							@property
							def  A__      (				self):
												return 1E-5





							@property
							def  A__      (				self):
												return 1_2






from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowercase__		:int   =    logging.get_logger(__name__)

lowercase__		:Any   =    {
    "sail/poolformer_s12": "https://huggingface.co/sail/poolformer_s12/resolve/main/config.json",
    # See all PoolFormer models at https://huggingface.co/models?filter=poolformer
}







class 				lowercase		(					SCREAMING_SNAKE_CASE__		):
							lowercase_       :       Optional[Any]       					='''poolformer'''




							def __init__(				self   ,A__=3   ,A__=1_6   ,A__=1_6   ,A__=3   ,A__=4.0   ,A__=[2, 2, 6, 2]   ,A__=[6_4, 1_2_8, 3_2_0, 5_1_2]   ,A__=[7, 3, 3, 3]   ,A__=[4, 2, 2, 2]   ,A__=[2, 1, 1, 1]   ,A__=4   ,A__=0.0   ,A__="gelu"   ,A__=True   ,A__=1E-5   ,A__=0.02   ,**A__   ,):
												lowercase							=						num_channels
												lowercase							=						patch_size
												lowercase							=						stride
												lowercase							=						padding
												lowercase							=						pool_size
												lowercase							=						hidden_sizes
												lowercase							=						mlp_ratio
												lowercase							=						depths
												lowercase							=						patch_sizes
												lowercase							=						strides
												lowercase							=						num_encoder_blocks
												lowercase							=						drop_path_rate
												lowercase							=						hidden_act
												lowercase							=						use_layer_scale
												lowercase							=						layer_scale_init_value
												lowercase							=						initializer_range
												super().__init__(**A__)







class 				lowercase		(					SCREAMING_SNAKE_CASE__		):
							lowercase_       :       List[Any]       					=version.parse('''1.11'''		)




							@property
							def  A__      (				self):
												return OrderedDict(
												    [
												        ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
												    ])





							@property
							def  A__      (				self):
												return 2E-3




