





'''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


A__				:   Optional[int]      =logging.get_logger(__name__)

A__				:   Optional[Any]      ={
    '''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     (			snake_case_   ):
      _lowercase:			List[Any]						     =   '''segformer'''




      def __init__(			self			: Any			,			__snake_case			: Any=3			,			__snake_case			: List[str]=4			,			__snake_case			: Union[str, Any]=[2, 2, 2, 2]			,			__snake_case			: Dict=[8, 4, 2, 1]			,			__snake_case			: List[str]=[32, 64, 1_60, 2_56]			,			__snake_case			: Optional[int]=[7, 3, 3, 3]			,			__snake_case			: Optional[Any]=[4, 2, 2, 2]			,			__snake_case			: Any=[1, 2, 5, 8]			,			__snake_case			: List[Any]=[4, 4, 4, 4]			,			__snake_case			: List[str]="gelu"			,			__snake_case			: List[str]=0.0			,			__snake_case			: Optional[int]=0.0			,			__snake_case			: Optional[int]=0.1			,			__snake_case			: Optional[int]=0.02			,			__snake_case			: Tuple=0.1			,			__snake_case			: Any=1E-6			,			__snake_case			: Any=2_56			,			__snake_case			: Optional[int]=2_55			,			**__snake_case			: str			,			)				->      List[str]:
            super().__init__(**__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."""			,			__snake_case			,			)

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




class  UpperCAmelCase     (			snake_case_   ):
      _lowercase:			Optional[Any]						     =   version.parse('''1.11'''   )




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




      @property
      def 				lowercase__    (			self			: Any  )				->      float:
            return 1E-4




      @property
      def 				lowercase__    (			self			: List[Any]  )				->      int:
            return 12













'''simple docstring'''

from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


lowercase_					= {"""configuration_mbart""": ["""MBART_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MBartConfig""", """MBartOnnxConfig"""]}

try:
      if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase_					= ["""MBartTokenizer"""]

try:
      if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase_					= ["""MBartTokenizerFast"""]

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase_					= [
          """MBART_PRETRAINED_MODEL_ARCHIVE_LIST""",
          """MBartForCausalLM""",
          """MBartForConditionalGeneration""",
          """MBartForQuestionAnswering""",
          """MBartForSequenceClassification""",
          """MBartModel""",
          """MBartPreTrainedModel""",
      ]

try:
      if not is_tf_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase_					= [
          """TFMBartForConditionalGeneration""",
          """TFMBartModel""",
          """TFMBartPreTrainedModel""",
      ]

try:
      if not is_flax_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase_					= [
          """FlaxMBartForConditionalGeneration""",
          """FlaxMBartForQuestionAnswering""",
          """FlaxMBartForSequenceClassification""",
          """FlaxMBartModel""",
          """FlaxMBartPreTrainedModel""",
      ]


if TYPE_CHECKING:
      from .configuration_mbart import MBART_PRETRAINED_CONFIG_ARCHIVE_MAP, MBartConfig, MBartOnnxConfig

      try:
            if not is_sentencepiece_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_mbart import MBartTokenizer

      try:
            if not is_tokenizers_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_mbart_fast import MBartTokenizerFast

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_mbart import (
                MBART_PRETRAINED_MODEL_ARCHIVE_LIST,
                MBartForCausalLM,
                MBartForConditionalGeneration,
                MBartForQuestionAnswering,
                MBartForSequenceClassification,
                MBartModel,
                MBartPreTrainedModel,
            )

      try:
            if not is_tf_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_tf_mbart import TFMBartForConditionalGeneration, TFMBartModel, TFMBartPreTrainedModel

      try:
            if not is_flax_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_flax_mbart import (
                FlaxMBartForConditionalGeneration,
                FlaxMBartForQuestionAnswering,
                FlaxMBartForSequenceClassification,
                FlaxMBartModel,
                FlaxMBartPreTrainedModel,
            )

else:
      import sys

      lowercase_					= _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



