





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   UpperCamelCase_       (     UpperCamelCase__    ):
							lowerCamelCase_           =					"segformer"


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



									"""simple docstring"""



									super().__init__(**__A		)

									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."""							,				__A							,				)

									SCREAMING_SNAKE_CASE__			=      num_channels
									SCREAMING_SNAKE_CASE__			=      num_encoder_blocks
									SCREAMING_SNAKE_CASE__			=      depths
									SCREAMING_SNAKE_CASE__			=      sr_ratios
									SCREAMING_SNAKE_CASE__			=      hidden_sizes
									SCREAMING_SNAKE_CASE__			=      patch_sizes
									SCREAMING_SNAKE_CASE__			=      strides
									SCREAMING_SNAKE_CASE__			=      mlp_ratios
									SCREAMING_SNAKE_CASE__			=      num_attention_heads
									SCREAMING_SNAKE_CASE__			=      hidden_act
									SCREAMING_SNAKE_CASE__			=      hidden_dropout_prob
									SCREAMING_SNAKE_CASE__			=      attention_probs_dropout_prob
									SCREAMING_SNAKE_CASE__			=      classifier_dropout_prob
									SCREAMING_SNAKE_CASE__			=      initializer_range
									SCREAMING_SNAKE_CASE__			=      drop_path_rate
									SCREAMING_SNAKE_CASE__			=      layer_norm_eps
									SCREAMING_SNAKE_CASE__			=      decoder_hidden_size
									SCREAMING_SNAKE_CASE__			=      kwargs.get("""reshape_last_stage"""							,				__A		)
									SCREAMING_SNAKE_CASE__			=      semantic_loss_ignore_index




class   UpperCamelCase_       (     UpperCamelCase__    ):
							lowerCamelCase_           =					version.parse("1.11"    )


							@property
							def      _snake_case  (							self    :Union[str, Any]		)   ->   Mapping[str, Mapping[int, str]]:



									"""simple docstring"""



									return OrderedDict(
									    [
									        ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
									    ]		)


							@property
							def      _snake_case  (							self    :Optional[Any]		)   ->   float:



									"""simple docstring"""



									return 1E-4


							@property
							def      _snake_case  (							self    :str		)   ->   int:



									"""simple docstring"""



									return 12






import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import ClassLabel, Features, Image
from .base import TaskTemplate




@dataclass(frozen=UpperCamelCase__    )
class   UpperCamelCase_       (     UpperCamelCase__    ):
							lowerCamelCase_           =					field(default="image-classification"				,  metadata={"include_in_asdict_even_if_is_default": True}    )
							lowerCamelCase_           =					Features({"image": Image()}    )
							lowerCamelCase_           =					Features({"labels": ClassLabel}    )
							lowerCamelCase_           =					"image"
							lowerCamelCase_           =					"labels"


							def      _snake_case  (							self    :List[str]							,				__A    :Tuple		)   ->   Tuple:



									"""simple docstring"""



									if self.label_column not in features:
											raise ValueError(f'''Column {self.label_column} is not present in features.'''		)
									if not isinstance(features[self.label_column]							,				__A		):
											raise ValueError(f'''Column {self.label_column} is not a ClassLabel.'''		)
									SCREAMING_SNAKE_CASE__			=      copy.deepcopy(self		)
									SCREAMING_SNAKE_CASE__			=      self.label_schema.copy()
									SCREAMING_SNAKE_CASE__			=      features[self.label_column]
									SCREAMING_SNAKE_CASE__			=      label_schema
									return task_template


							@property
							def      _snake_case  (							self    :Dict		)   ->   Dict[str, str]:



									"""simple docstring"""



									return {
									    self.image_column: "image",
									    self.label_column: "labels",
									}