





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 			__A       (      lowerCamelCase__  ):




      """simple docstring"""







      UpperCAmelCase__						=      """segformer"""


      def __init__(		self      ,							a__=3      ,							a__=4      ,							a__=[2, 2, 2, 2]      ,							a__=[8, 4, 2, 1]      ,							a__=[32, 64, 160, 256]      ,							a__=[7, 3, 3, 3]      ,							a__=[4, 2, 2, 2]      ,							a__=[1, 2, 5, 8]      ,							a__=[4, 4, 4, 4]      ,							a__="gelu"      ,							a__=0.0      ,							a__=0.0      ,							a__=0.1      ,							a__=0.02      ,							a__=0.1      ,							a__=1e-6      ,							a__=256      ,							a__=255      ,							**a__      ,							):



             """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__      ,							)

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







class 			__A       (      lowerCamelCase__  ):




      """simple docstring"""







      UpperCAmelCase__						=      version.parse("""1.11"""  )


      @property
      def 				__snake_case			(		self):



             """simple docstring"""





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


      @property
      def 				__snake_case			(		self):



             """simple docstring"""





             return 1e-4



      @property
      def 				__snake_case			(		self):



             """simple docstring"""





             return 12








from typing import TYPE_CHECKING

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


_lowerCamelCase			       =      {'configuration_opt': ['OPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'OPTConfig']}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       _lowerCamelCase			       =      [
           'OPT_PRETRAINED_MODEL_ARCHIVE_LIST',
           'OPTForCausalLM',
           'OPTModel',
           'OPTPreTrainedModel',
           'OPTForSequenceClassification',
           'OPTForQuestionAnswering',
       ]

try:
       if not is_tf_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       _lowerCamelCase			       =      ['TFOPTForCausalLM', 'TFOPTModel', 'TFOPTPreTrainedModel']

try:
       if not is_flax_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       _lowerCamelCase			       =      [
           'FlaxOPTForCausalLM',
           'FlaxOPTModel',
           'FlaxOPTPreTrainedModel',
       ]


if TYPE_CHECKING:
       from .configuration_opt import OPT_PRETRAINED_CONFIG_ARCHIVE_MAP, OPTConfig

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_opt import (
                  OPT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  OPTForCausalLM,
                  OPTForQuestionAnswering,
                  OPTForSequenceClassification,
                  OPTModel,
                  OPTPreTrainedModel,
              )

       try:
              if not is_tf_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tf_opt import TFOPTForCausalLM, TFOPTModel, TFOPTPreTrainedModel

       try:
              if not is_flax_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_flax_opt import FlaxOPTForCausalLM, FlaxOPTModel, FlaxOPTPreTrainedModel

else:
       import sys

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

