



"""simple docstring"""


from ...configuration_utils import PretrainedConfig
from ...utils import logging


snake_case_				     =       logging.get_logger(__name__)

snake_case_				     =       {
    """microsoft/trocr-base-handwritten""": (
        """https://huggingface.co/microsoft/trocr-base-handwritten/resolve/main/config.json"""
    ),
    # See all TrOCR models at https://huggingface.co/models?filter=trocr
}







class       A_			(     __SCREAMING_SNAKE_CASE				):



						"""simple docstring"""
						__UpperCamelCase						=							"""trocr"""
						__UpperCamelCase						=							["""past_key_values"""]
						__UpperCamelCase						=							{
						    """num_attention_heads""": """decoder_attention_heads""",
						    """hidden_size""": """d_model""",
						    """num_hidden_layers""": """decoder_layers""",
						}






						def __init__(					self :Dict   ,  lowercase_ :Any=5_02_65   ,  lowercase_ :int=10_24   ,  lowercase_ :int=12   ,  lowercase_ :Tuple=16   ,  lowercase_ :int=40_96   ,  lowercase_ :Optional[int]="gelu"   ,  lowercase_ :Union[str, Any]=5_12   ,  lowercase_ :str=0.1   ,  lowercase_ :Any=0.0   ,  lowercase_ :List[Any]=0.0   ,  lowercase_ :Dict=2   ,  lowercase_ :str=0.02   ,  lowercase_ :str=0.0   ,  lowercase_ :Any=True   ,  lowercase_ :Optional[int]=False   ,  lowercase_ :Union[str, Any]=True   ,  lowercase_ :Optional[Any]=True   ,  lowercase_ :str=1   ,  lowercase_ :List[Any]=0   ,  lowercase_ :int=2   ,  **lowercase_ :Union[str, Any]   ,  )				->			Optional[int]:
												UpperCAmelCase             = vocab_size
												UpperCAmelCase             = d_model
												UpperCAmelCase             = decoder_layers
												UpperCAmelCase             = decoder_attention_heads
												UpperCAmelCase             = decoder_ffn_dim
												UpperCAmelCase             = activation_function
												UpperCAmelCase             = max_position_embeddings
												UpperCAmelCase             = dropout
												UpperCAmelCase             = attention_dropout
												UpperCAmelCase             = activation_dropout
												UpperCAmelCase             = init_std
												UpperCAmelCase             = decoder_layerdrop
												UpperCAmelCase             = use_cache
												UpperCAmelCase             = scale_embedding
												UpperCAmelCase             = use_learned_position_embeddings
												UpperCAmelCase             = layernorm_embedding

												super().__init__(
												    pad_token_id=lowercase_   ,  bos_token_id=lowercase_   ,  eos_token_id=lowercase_   ,  decoder_start_token_id=lowercase_   ,  **lowercase_   ,  )







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__		(	__SCREAMING_SNAKE_CASE):
      _UpperCAmelCase				:    Dict           =			"""segformer"""
      def __init__(      self    ,  __magic_name__=3    ,  __magic_name__=4    ,  __magic_name__=[2, 2, 2, 2]    ,  __magic_name__=[8, 4, 2, 1]    ,  __magic_name__=[3_2, 6_4, 1_6_0, 2_5_6]    ,  __magic_name__=[7, 3, 3, 3]    ,  __magic_name__=[4, 2, 2, 2]    ,  __magic_name__=[1, 2, 5, 8]    ,  __magic_name__=[4, 4, 4, 4]    ,  __magic_name__="gelu"    ,  __magic_name__=0.0    ,  __magic_name__=0.0    ,  __magic_name__=0.1    ,  __magic_name__=0.02    ,  __magic_name__=0.1    ,  __magic_name__=1e-6    ,  __magic_name__=2_5_6    ,  __magic_name__=2_5_5    ,  **__magic_name__    ,  ):
       super().__init__(**__magic_name__      )

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

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





class 							A__		(	__SCREAMING_SNAKE_CASE):
      _UpperCAmelCase				:    str           =			version.parse("""1.11""")
      @property
      def 						UpperCamelCase__							(      self      ):
       return OrderedDict(
           [
               ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
           ]      )
      @property
      def 						UpperCamelCase__							(      self      ):
       return 1e-4






      @property
      def 						UpperCamelCase__							(      self      ):
       return 1_2




