





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


UpperCAmelCase_      							=     logging.get_logger(__name__)

UpperCAmelCase_      							=     {
    """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 			UpperCamelCase_		(  _lowerCamelCase					):
					lowerCAmelCase_							=	'''trocr'''
					lowerCAmelCase_							=	['''past_key_values''']
					lowerCAmelCase_							=	{
					    '''num_attention_heads''': '''decoder_attention_heads''',
					    '''hidden_size''': '''d_model''',
					    '''num_hidden_layers''': '''decoder_layers''',
					}




					def __init__(		self				,						lowerCAmelCase_=5_0265				,						lowerCAmelCase_=1024				,						lowerCAmelCase_=12				,						lowerCAmelCase_=16				,						lowerCAmelCase_=4096				,						lowerCAmelCase_="gelu"				,						lowerCAmelCase_=512				,						lowerCAmelCase_=0.1				,						lowerCAmelCase_=0.0				,						lowerCAmelCase_=0.0				,						lowerCAmelCase_=2				,						lowerCAmelCase_=0.02				,						lowerCAmelCase_=0.0				,						lowerCAmelCase_=True				,						lowerCAmelCase_=False				,						lowerCAmelCase_=True				,						lowerCAmelCase_=True				,						lowerCAmelCase_=1				,						lowerCAmelCase_=0				,						lowerCAmelCase_=2				,						**lowerCAmelCase_				,						)		->							int:
										_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_				,						)










from typing import TYPE_CHECKING

from ...utils import _LazyModule


UpperCAmelCase_      							=     {"""tokenization_byt5""": ["""ByT5Tokenizer"""]}


if TYPE_CHECKING:
					from .tokenization_byta import ByTaTokenizer
else:
					import sys

					UpperCAmelCase_      							=     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



