


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 			_a				(     UpperCamelCase__     ):
							_lowercase      :     Optional[Any]     =					'''trocr'''
							_lowercase      :     int     =					['''past_key_values''']
							_lowercase      :     Dict     =					{
							    '''num_attention_heads''': '''decoder_attention_heads''',
							    '''hidden_size''': '''d_model''',
							    '''num_hidden_layers''': '''decoder_layers''',
							}

							def __init__(				self:      int       ,		UpperCamelCase_:      Tuple=50_265       ,		UpperCamelCase_:      List[str]=1_024       ,		UpperCamelCase_:      Dict=12       ,		UpperCamelCase_:      Optional[Any]=16       ,		UpperCamelCase_:      Tuple=4_096       ,		UpperCamelCase_:      Tuple="gelu"       ,		UpperCamelCase_:      Union[str, Any]=512       ,		UpperCamelCase_:      Optional[Any]=0.1       ,		UpperCamelCase_:      Any=0.0       ,		UpperCamelCase_:      Union[str, Any]=0.0       ,		UpperCamelCase_:      Optional[Any]=2       ,		UpperCamelCase_:      Optional[int]=0.02       ,		UpperCamelCase_:      Optional[Any]=0.0       ,		UpperCamelCase_:      Dict=True       ,		UpperCamelCase_:      Dict=False       ,		UpperCamelCase_:      Dict=True       ,		UpperCamelCase_:      Optional[Any]=True       ,		UpperCamelCase_:      List[str]=1       ,		UpperCamelCase_:      Union[str, Any]=0       ,		UpperCamelCase_:      Tuple=2       ,		**UpperCamelCase_:      str       ,		)     ->  Optional[int]:





									"""simple docstring"""







									lowercase__				= vocab_size
									lowercase__				= d_model
									lowercase__				= decoder_layers
									lowercase__				= decoder_attention_heads
									lowercase__				= decoder_ffn_dim
									lowercase__				= activation_function
									lowercase__				= max_position_embeddings
									lowercase__				= dropout
									lowercase__				= attention_dropout
									lowercase__				= activation_dropout
									lowercase__				= init_std
									lowercase__				= decoder_layerdrop
									lowercase__				= use_cache
									lowercase__				= scale_embedding
									lowercase__				= use_learned_position_embeddings
									lowercase__				= layernorm_embedding

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






"""simple docstring"""


def    _lowerCamelCase   (     lowerCamelCase__	:							Optional[Any]  ):
 lowercase__       :       List[str]				=						len(lowerCamelCase__  )
 lowercase__       :       Optional[int]				=						sum(lowerCamelCase__  )

 lowercase__       :       Optional[int]				=						[[False for x in range(s + 1  )] for y in range(n + 1  )]

 for i in range(1       ,		n + 1  ):
  lowercase__       :       int				=						True

 for i in range(1       ,		s + 1  ):
  lowercase__       :       int				=						False

 for i in range(1       ,		n + 1  ):
  for j in range(1       ,		s + 1  ):
   lowercase__       :       Optional[Any]				=						dp[i][j - 1]

   if arr[i - 1] <= j:
    lowercase__       :       int				=						dp[i][j] or dp[i - 1][j - arr[i - 1]]

 for j in range(int(s / 2  )       ,		-1       ,		-1  ):
  if dp[n][j] is True:
   lowercase__       :       List[Any]				=						s - 2 * j
   break

 return diff