


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


lowerCAmelCase__      		= logging.get_logger(__name__)

lowerCAmelCase__      		= {
    '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      lowerCAmelCase__       (				a):




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


     def __init__(						self ,						__lowerCamelCase=5_0_2_6_5 ,						__lowerCamelCase=1_0_2_4 ,						__lowerCamelCase=1_2 ,						__lowerCamelCase=1_6 ,						__lowerCamelCase=4_0_9_6 ,						__lowerCamelCase="gelu" ,						__lowerCamelCase=5_1_2 ,						__lowerCamelCase=0.1 ,						__lowerCamelCase=0.0 ,						__lowerCamelCase=0.0 ,						__lowerCamelCase=2 ,						__lowerCamelCase=0.0_2 ,						__lowerCamelCase=0.0 ,						__lowerCamelCase=True ,						__lowerCamelCase=False ,						__lowerCamelCase=True ,						__lowerCamelCase=True ,						__lowerCamelCase=1 ,						__lowerCamelCase=0 ,						__lowerCamelCase=2 ,						**__lowerCamelCase ,						)			->				List[Any]:
            _A      :       Tuple				    = vocab_size
            _A      :       int				    = d_model
            _A      :       Optional[Any]				    = decoder_layers
            _A      :       int				    = decoder_attention_heads
            _A      :       List[Any]				    = decoder_ffn_dim
            _A      :       int				    = activation_function
            _A      :       int				    = max_position_embeddings
            _A      :       int				    = dropout
            _A      :       Tuple				    = attention_dropout
            _A      :       Any				    = activation_dropout
            _A      :       List[str]				    = init_std
            _A      :       Optional[int]				    = decoder_layerdrop
            _A      :       Tuple				    = use_cache
            _A      :       str				    = scale_embedding
            _A      :       Any				    = use_learned_position_embeddings
            _A      :       Optional[Any]				    = layernorm_embedding

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






"""simple docstring"""




def     a__ (				snake_case__       , snake_case__ = False				)						->					str:

			if not isinstance(snake_case__       , snake_case__				):
						lowerCamelCase			      =					F'Expected string as input, found {type(snake_case__				)}'
						raise ValueError(snake_case__				)
			if not isinstance(snake_case__       , snake_case__				):
						lowerCamelCase			      =					F'Expected boolean as use_pascal parameter, found {type(snake_case__				)}'
						raise ValueError(snake_case__				)

			lowerCamelCase			      =					input_str.split("""_"""				)

			lowerCamelCase			      =					0 if use_pascal else 1

			lowerCamelCase			      =					words[start_index:]

			lowerCamelCase			      =					[word[0].upper() + word[1:] for word in words_to_capitalize]

			lowerCamelCase			      =					"""""" if use_pascal else words[0]

			return "".join([initial_word, *capitalized_words]				)


if __name__ == "__main__":
					from doctest import testmod

					testmod()



