






'''simple docstring'''







import warnings
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


__lowerCAmelCase									=   logging.get_logger(__name__)

__lowerCAmelCase									=   {
    'nvidia/segformer-b0-finetuned-ade-512-512': (
        'https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512/resolve/main/config.json'
    ),
    # See all SegFormer models at https://huggingface.co/models?filter=segformer
}





class 						SCREAMING_SNAKE_CASE       (       SCREAMING_SNAKE_CASE_							):
			snake_case__	=					"segformer"






			def __init__(			self   :      Union[str, Any]	,    __SCREAMING_SNAKE_CASE   :      Dict=3	,    __SCREAMING_SNAKE_CASE   :      str=4	,    __SCREAMING_SNAKE_CASE   :      List[str]=[2, 2, 2, 2]	,    __SCREAMING_SNAKE_CASE   :      List[Any]=[8, 4, 2, 1]	,    __SCREAMING_SNAKE_CASE   :      List[Any]=[32, 64, 160, 256]	,    __SCREAMING_SNAKE_CASE   :      int=[7, 3, 3, 3]	,    __SCREAMING_SNAKE_CASE   :      List[str]=[4, 2, 2, 2]	,    __SCREAMING_SNAKE_CASE   :      Union[str, Any]=[1, 2, 5, 8]	,    __SCREAMING_SNAKE_CASE   :      Tuple=[4, 4, 4, 4]	,    __SCREAMING_SNAKE_CASE   :      int="gelu"	,    __SCREAMING_SNAKE_CASE   :      Tuple=0.0	,    __SCREAMING_SNAKE_CASE   :      int=0.0	,    __SCREAMING_SNAKE_CASE   :      List[Any]=0.1	,    __SCREAMING_SNAKE_CASE   :      Any=0.02	,    __SCREAMING_SNAKE_CASE   :      Tuple=0.1	,    __SCREAMING_SNAKE_CASE   :      Union[str, Any]=1e-6	,    __SCREAMING_SNAKE_CASE   :      Optional[int]=256	,    __SCREAMING_SNAKE_CASE   :      Optional[Any]=255	,    **__SCREAMING_SNAKE_CASE   :      List[Any]	,    )      ->      Any:
							super().__init__(**__SCREAMING_SNAKE_CASE       )

							if "reshape_last_stage" in kwargs and kwargs["reshape_last_stage"] is False:
											warnings.warn(
											    '''Reshape_last_stage is set to False in this config. This argument is deprecated and will soon be'''
											    ''' removed, as the behaviour will default to that of reshape_last_stage = True.'''	,    __SCREAMING_SNAKE_CASE	,    )

							a_		:	List[Any]									=   num_channels
							a_		:	Optional[Any]									=   num_encoder_blocks
							a_		:	Union[str, Any]									=   depths
							a_		:	int									=   sr_ratios
							a_		:	str									=   hidden_sizes
							a_		:	Any									=   patch_sizes
							a_		:	int									=   strides
							a_		:	Optional[Any]									=   mlp_ratios
							a_		:	Optional[int]									=   num_attention_heads
							a_		:	str									=   hidden_act
							a_		:	List[Any]									=   hidden_dropout_prob
							a_		:	Union[str, Any]									=   attention_probs_dropout_prob
							a_		:	Optional[int]									=   classifier_dropout_prob
							a_		:	Any									=   initializer_range
							a_		:	int									=   drop_path_rate
							a_		:	Dict									=   layer_norm_eps
							a_		:	Tuple									=   decoder_hidden_size
							a_		:	str									=   kwargs.get('''reshape_last_stage'''	,    __SCREAMING_SNAKE_CASE       )
							a_		:	Any									=   semantic_loss_ignore_index





class 						SCREAMING_SNAKE_CASE       (       SCREAMING_SNAKE_CASE_							):
			snake_case__	=					version.parse("1.11"							)






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






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







			@property
			def       SCREAMING_SNAKE_CASE   (			self   :      int       )      ->      int:
							return 12












'''simple docstring'''







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__lowerCAmelCase									=   {'configuration_sew': ['SEW_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SEWConfig']}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__lowerCAmelCase									=   [
		    'SEW_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'SEWForCTC',
		    'SEWForSequenceClassification',
		    'SEWModel',
		    'SEWPreTrainedModel',
		]

if TYPE_CHECKING:
		from .configuration_sew import SEW_PRETRAINED_CONFIG_ARCHIVE_MAP, SEWConfig

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_sew import (
				    SEW_PRETRAINED_MODEL_ARCHIVE_LIST,
				    SEWForCTC,
				    SEWForSequenceClassification,
				    SEWModel,
				    SEWPreTrainedModel,
				)


else:
		import sys

		__lowerCAmelCase									=   _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




