

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


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

_UpperCAmelCase						:  Union[str, Any]									=			{
    """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							(			lowercase_     ):
				__SCREAMING_SNAKE_CASE   :					List[str]			     =     '''trocr'''
				__SCREAMING_SNAKE_CASE   :					Union[str, Any]			     =     ['''past_key_values''']
				__SCREAMING_SNAKE_CASE   :					Dict			     =     {
				    '''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=snake_case ,  bos_token_id=snake_case ,  eos_token_id=snake_case ,  decoder_start_token_id=snake_case ,  **snake_case ,  )







_UpperCAmelCase						:  Any									=			6_5521





def    __lowerCamelCase      (					UpperCamelCase__ ):







							'''simple docstring'''






							snake_case_     							=       1
							snake_case_     							=       0
							for plain_chr in plain_text:
														snake_case_     							=       (a + ord(UpperCamelCase__ )) % MOD_ADLER
														snake_case_     							=       (b + a) % MOD_ADLER
							return (b << 16) | a




