

'''simple docstring'''





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


_UpperCAmelCase	:     Any		       = logging.get_logger(__name__)

_UpperCAmelCase	:     Optional[int]		       = {
    "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 				lowercase       ( _UpperCAmelCase    ):
				__SCREAMING_SNAKE_CASE      :				Union[str, Any]     =    '''trocr'''
				__SCREAMING_SNAKE_CASE      :				Union[str, Any]     =    ['''past_key_values''']
				__SCREAMING_SNAKE_CASE      :				Union[str, Any]     =    {
				    '''num_attention_heads''': '''decoder_attention_heads''',
				    '''hidden_size''': '''d_model''',
				    '''num_hidden_layers''': '''decoder_layers''',
				}




				def __init__(      self   ,     snake_case=5_0265   ,     snake_case=1024   ,     snake_case=12   ,     snake_case=16   ,     snake_case=4096   ,     snake_case="gelu"   ,     snake_case=512   ,     snake_case=0.1   ,     snake_case=0.0   ,     snake_case=0.0   ,     snake_case=2   ,     snake_case=0.02   ,     snake_case=0.0   ,     snake_case=True   ,     snake_case=False   ,     snake_case=True   ,     snake_case=True   ,     snake_case=1   ,     snake_case=0   ,     snake_case=2   ,     **snake_case   ,     ):
											snake_case_           =					vocab_size
											snake_case_           =					d_model
											snake_case_           =					decoder_layers
											snake_case_           =					decoder_attention_heads
											snake_case_           =					decoder_ffn_dim
											snake_case_           =					activation_function
											snake_case_           =					max_position_embeddings
											snake_case_           =					dropout
											snake_case_           =					attention_dropout
											snake_case_           =					activation_dropout
											snake_case_           =					init_std
											snake_case_           =					decoder_layerdrop
											snake_case_           =					use_cache
											snake_case_           =					scale_embedding
											snake_case_           =					use_learned_position_embeddings
											snake_case_           =					layernorm_embedding

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







def       __lowerCamelCase			(				UpperCamelCase__   ):







							'''simple docstring'''






							if not nums:  # Makes sure that the list is not empty
														raise ValueError('List is empty'   )

							snake_case_           =					sum(UpperCamelCase__   ) / len(UpperCamelCase__   )  # Calculate the average
							return sum(abs(x - average   ) for x in nums   ) / len(UpperCamelCase__   )


if __name__ == "__main__":
					import doctest

					doctest.testmod()




