






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


_UpperCamelCase    :   Union[str, Any]   			=						logging.get_logger(__name__)

_UpperCamelCase    :   Union[str, 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 						snake_case  (  UpperCAmelCase	):
    __magic_name__   					=					'''segformer'''





    def __init__(							self     : Optional[Any]    ,		A     : int=3    ,		A     : Any=4    ,		A     : Dict=[2, 2, 2, 2]    ,		A     : List[Any]=[8, 4, 2, 1]    ,		A     : Union[str, Any]=[3_2, 6_4, 1_6_0, 2_5_6]    ,		A     : Union[str, Any]=[7, 3, 3, 3]    ,		A     : List[str]=[4, 2, 2, 2]    ,		A     : Dict=[1, 2, 5, 8]    ,		A     : Tuple=[4, 4, 4, 4]    ,		A     : Any="gelu"    ,		A     : int=0.0    ,		A     : Union[str, Any]=0.0    ,		A     : Optional[Any]=0.1    ,		A     : int=0.02    ,		A     : Optional[Any]=0.1    ,		A     : Tuple=1E-6    ,		A     : int=2_5_6    ,		A     : List[str]=2_5_5    ,		**A     : int    ,		):


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

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






class 						snake_case  (  UpperCAmelCase	):
    __magic_name__   					=					version.parse('''1.11'''	)





    @property
    def     lowerCamelCase__				(							self     : Union[str, Any]      ):


      '''simple docstring'''




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





    @property
    def     lowerCamelCase__				(							self     : str      ):


      '''simple docstring'''




      return 1E-4





    @property
    def     lowerCamelCase__				(							self     : List[str]      ):


      '''simple docstring'''




      return 1_2












"""simple docstring"""


import os
import sys

_UpperCamelCase    :   str   			=						os.path.join(os.path.dirname(__file__), 'src')
sys.path.append(SRC_DIR)


from transformers import (
    AutoConfig,
    AutoModel,
    AutoModelForCausalLM,
    AutoModelForMaskedLM,
    AutoModelForQuestionAnswering,
    AutoModelForSequenceClassification,
    AutoTokenizer,
    add_start_docstrings,
)


_UpperCamelCase    :   int   			=						[
    'torch',
    'numpy',
    'tokenizers',
    'filelock',
    'requests',
    'tqdm',
    'regex',
    'sentencepiece',
    'sacremoses',
    'importlib_metadata',
    'huggingface_hub',
]




@add_start_docstrings(AutoConfig.__doc__				)
def       snake_case  (*A_				:Optional[int]     ,      **A_				:int				):







  '''simple docstring'''

  return AutoConfig.from_pretrained(*A_     ,      **A_				)




@add_start_docstrings(AutoTokenizer.__doc__				)
def       snake_case  (*A_				:Optional[int]     ,      **A_				:List[Any]				):







  '''simple docstring'''

  return AutoTokenizer.from_pretrained(*A_     ,      **A_				)




@add_start_docstrings(AutoModel.__doc__				)
def       snake_case  (*A_				:Optional[Any]     ,      **A_				:Tuple				):







  '''simple docstring'''

  return AutoModel.from_pretrained(*A_     ,      **A_				)




@add_start_docstrings(AutoModelForCausalLM.__doc__				)
def       snake_case  (*A_				:str     ,      **A_				:Optional[int]				):







  '''simple docstring'''

  return AutoModelForCausalLM.from_pretrained(*A_     ,      **A_				)




@add_start_docstrings(AutoModelForMaskedLM.__doc__				)
def       snake_case  (*A_				:Optional[Any]     ,      **A_				:Dict				):







  '''simple docstring'''

  return AutoModelForMaskedLM.from_pretrained(*A_     ,      **A_				)




@add_start_docstrings(AutoModelForSequenceClassification.__doc__				)
def       snake_case  (*A_				:Dict     ,      **A_				:str				):







  '''simple docstring'''

  return AutoModelForSequenceClassification.from_pretrained(*A_     ,      **A_				)






@add_start_docstrings(AutoModelForQuestionAnswering.__doc__				)
def       snake_case  (*A_				:Dict     ,      **A_				:List[Any]				):







  '''simple docstring'''

  return AutoModelForQuestionAnswering.from_pretrained(*A_     ,      **A_				)




