






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


lowercase  :							Optional[int]			  =    logging.get_logger(__name__)

lowercase  :							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 		UpperCAmelCase_						(	a__					):


						'''simple docstring'''




						A     :   Optional[int]						=					'trocr'
						A     :   Dict						=					['past_key_values']
						A     :   Dict						=					{
						    'num_attention_heads': 'decoder_attention_heads',
						    'hidden_size': 'd_model',
						    'num_hidden_layers': 'decoder_layers',
						}






						def __init__(	self		,				_SCREAMING_SNAKE_CASE=5_0265		,				_SCREAMING_SNAKE_CASE=1024		,				_SCREAMING_SNAKE_CASE=12		,				_SCREAMING_SNAKE_CASE=16		,				_SCREAMING_SNAKE_CASE=4096		,				_SCREAMING_SNAKE_CASE="gelu"		,				_SCREAMING_SNAKE_CASE=512		,				_SCREAMING_SNAKE_CASE=0.1		,				_SCREAMING_SNAKE_CASE=0.0		,				_SCREAMING_SNAKE_CASE=0.0		,				_SCREAMING_SNAKE_CASE=2		,				_SCREAMING_SNAKE_CASE=0.02		,				_SCREAMING_SNAKE_CASE=0.0		,				_SCREAMING_SNAKE_CASE=True		,				_SCREAMING_SNAKE_CASE=False		,				_SCREAMING_SNAKE_CASE=True		,				_SCREAMING_SNAKE_CASE=True		,				_SCREAMING_SNAKE_CASE=1		,				_SCREAMING_SNAKE_CASE=0		,				_SCREAMING_SNAKE_CASE=2		,				**_SCREAMING_SNAKE_CASE		,				) ->				Dict:
								snake_case_				:							Union[str, Any]						 =       vocab_size
								snake_case_				:							Tuple						 =       d_model
								snake_case_				:							List[str]						 =       decoder_layers
								snake_case_				:							int						 =       decoder_attention_heads
								snake_case_				:							Optional[int]						 =       decoder_ffn_dim
								snake_case_				:							Optional[Any]						 =       activation_function
								snake_case_				:							List[Any]						 =       max_position_embeddings
								snake_case_				:							Tuple						 =       dropout
								snake_case_				:							Tuple						 =       attention_dropout
								snake_case_				:							str						 =       activation_dropout
								snake_case_				:							int						 =       init_std
								snake_case_				:							Dict						 =       decoder_layerdrop
								snake_case_				:							List[str]						 =       use_cache
								snake_case_				:							int						 =       scale_embedding
								snake_case_				:							Optional[Any]						 =       use_learned_position_embeddings
								snake_case_				:							List[Any]						 =       layernorm_embedding

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









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


lowercase  :							Any			  =    logging.get_logger(__name__)

lowercase  :							str			  =    {
    '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''',
    # See all Donut models at https://huggingface.co/models?filter=donut-swin
}




class 		UpperCAmelCase_						(	SCREAMING_SNAKE_CASE__					):


						'''simple docstring'''




						A     :   Tuple						=					'donut-swin'

						A     :   Union[str, Any]						=					{
						    'num_attention_heads': 'num_heads',
						    'num_hidden_layers': 'num_layers',
						}






						def __init__(	self		,				_SCREAMING_SNAKE_CASE=224		,				_SCREAMING_SNAKE_CASE=4		,				_SCREAMING_SNAKE_CASE=3		,				_SCREAMING_SNAKE_CASE=96		,				_SCREAMING_SNAKE_CASE=[2, 2, 6, 2]		,				_SCREAMING_SNAKE_CASE=[3, 6, 12, 24]		,				_SCREAMING_SNAKE_CASE=7		,				_SCREAMING_SNAKE_CASE=4.0		,				_SCREAMING_SNAKE_CASE=True		,				_SCREAMING_SNAKE_CASE=0.0		,				_SCREAMING_SNAKE_CASE=0.0		,				_SCREAMING_SNAKE_CASE=0.1		,				_SCREAMING_SNAKE_CASE="gelu"		,				_SCREAMING_SNAKE_CASE=False		,				_SCREAMING_SNAKE_CASE=0.02		,				_SCREAMING_SNAKE_CASE=1e-5		,				**_SCREAMING_SNAKE_CASE		,				) ->				List[str]:
								super().__init__(**_SCREAMING_SNAKE_CASE				)

								snake_case_				:							Optional[int]						 =       image_size
								snake_case_				:							Any						 =       patch_size
								snake_case_				:							str						 =       num_channels
								snake_case_				:							Dict						 =       embed_dim
								snake_case_				:							Tuple						 =       depths
								snake_case_				:							List[Any]						 =       len(_SCREAMING_SNAKE_CASE				)
								snake_case_				:							Optional[int]						 =       num_heads
								snake_case_				:							Optional[int]						 =       window_size
								snake_case_				:							Any						 =       mlp_ratio
								snake_case_				:							str						 =       qkv_bias
								snake_case_				:							Optional[Any]						 =       hidden_dropout_prob
								snake_case_				:							Union[str, Any]						 =       attention_probs_dropout_prob
								snake_case_				:							str						 =       drop_path_rate
								snake_case_				:							List[str]						 =       hidden_act
								snake_case_				:							Optional[int]						 =       use_absolute_embeddings
								snake_case_				:							Tuple						 =       layer_norm_eps
								snake_case_				:							List[Any]						 =       initializer_range
								# we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
								# this indicates the channel dimension after the last stage of the model
								snake_case_				:							Any						 =       int(embed_dim * 2 ** (len(_SCREAMING_SNAKE_CASE				) - 1)				)
