


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       :      List[Any]	=	logging.get_logger(__name__)

_lowercase       :      str	=	{
    "facebook/levit-128S": "https://huggingface.co/facebook/levit-128S/resolve/main/config.json",
    # See all LeViT models at https://huggingface.co/models?filter=levit
}






class       _UpperCamelCase    (					__snake_case				):

				"""simple docstring"""







				lowerCAmelCase 		= 'levit'

				def __init__(						self				,   a__=224				,   a__=3				,   a__=3				,   a__=2				,   a__=1				,   a__=16				,   a__=[128, 256, 384]				,   a__=[4, 8, 12]				,   a__=[4, 4, 4]				,   a__=[16, 16, 16]				,   a__=0				,   a__=[2, 2, 2]				,   a__=[2, 2, 2]				,   a__=0.02				,   **a__				,   )	->				List[Any]:
					super().__init__(**a__   )
					A								=				image_size
					A								=				num_channels
					A								=				kernel_size
					A								=				stride
					A								=				padding
					A								=				hidden_sizes
					A								=				num_attention_heads
					A								=				depths
					A								=				key_dim
					A								=				drop_path_rate
					A								=				patch_size
					A								=				attention_ratio
					A								=				mlp_ratio
					A								=				initializer_range
					A								=				[
					    ["""Subsample""", key_dim[0], hidden_sizes[0] // key_dim[0], 4, 2, 2],
					    ["""Subsample""", key_dim[0], hidden_sizes[1] // key_dim[0], 4, 2, 2],
					]






class       _UpperCamelCase    (					__snake_case				):

				"""simple docstring"""







				lowerCAmelCase 		= version.parse('1.11'				)

				@property
				def      _UpperCAmelCase					(						self   )	->				Mapping[str, Mapping[int, str]]:
					return OrderedDict(
					    [
					        ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
					    ]   )

				@property
				def      _UpperCAmelCase					(						self   )	->				float:
					return 1e-4







import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import CONFIG_MAPPING


_lowercase       :      int	=	logging.get_logger(__name__)






class       _UpperCamelCase    (					__snake_case				):

				"""simple docstring"""







				lowerCAmelCase 		= 'upernet'

				def __init__(						self				,   a__=None				,   a__=512				,   a__=0.02				,   a__=[1, 2, 3, 6]				,   a__=True				,   a__=0.4				,   a__=384				,   a__=256				,   a__=1				,   a__=False				,   a__=255				,   **a__				,   )	->				Tuple:
					super().__init__(**a__   )

					if backbone_config is None:
						logger.info("""`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone."""   )
						A								=				CONFIG_MAPPING["""resnet"""](out_features=["""stage1""", """stage2""", """stage3""", """stage4"""]   )
					elif isinstance(a__				,   a__   ):
						A								=				backbone_config.get("""model_type"""   )
						A								=				CONFIG_MAPPING[backbone_model_type]
						A								=				config_class.from_dict(a__   )

					A								=				backbone_config
					A								=				hidden_size
					A								=				initializer_range
					A								=				pool_scales
					A								=				use_auxiliary_head
					A								=				auxiliary_loss_weight
					A								=				auxiliary_in_channels
					A								=				auxiliary_channels
					A								=				auxiliary_num_convs
					A								=				auxiliary_concat_input
					A								=				loss_ignore_index

				def      _UpperCAmelCase					(						self   )	->				Dict:
					A								=				copy.deepcopy(self.__dict__   )
					A								=				self.backbone_config.to_dict()
					A								=				self.__class__.model_type
					return output



