



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       __lowerCAmelCase   (      __UpperCamelCase						):
			UpperCamelCase        =					"trocr"
			UpperCamelCase        =					["past_key_values"]
			UpperCamelCase        =					{
			    "num_attention_heads": "decoder_attention_heads",
			    "hidden_size": "d_model",
			    "num_hidden_layers": "decoder_layers",
			}



			def __init__(						self       :  Optional[Any]			,		A       :  Dict=5_02_65			,		A       :  Union[str, Any]=10_24			,		A       :  List[str]=12			,		A       :  Dict=16			,		A       :  Optional[int]=40_96			,		A       :  Tuple="gelu"			,		A       :  str=5_12			,		A       :  Dict=0.1			,		A       :  Dict=0.0			,		A       :  Union[str, Any]=0.0			,		A       :  str=2			,		A       :  Optional[Any]=0.0_2			,		A       :  List[Any]=0.0			,		A       :  str=True			,		A       :  Tuple=False			,		A       :  str=True			,		A       :  List[Any]=True			,		A       :  Any=1			,		A       :  Optional[int]=0			,		A       :  Optional[Any]=2			,		**A       :  Optional[Any]			,		)       ->   Dict:



								"""simple docstring"""






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

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





from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


UpperCAmelCase__       =	logging.get_logger(__name__)

UpperCAmelCase__       =	{
    "facebook/xmod-base": "https://huggingface.co/facebook/xmod-base/resolve/main/config.json",
    "facebook/xmod-large-prenorm": "https://huggingface.co/facebook/xmod-large-prenorm/resolve/main/config.json",
    "facebook/xmod-base-13-125k": "https://huggingface.co/facebook/xmod-base-13-125k/resolve/main/config.json",
    "facebook/xmod-base-30-125k": "https://huggingface.co/facebook/xmod-base-30-125k/resolve/main/config.json",
    "facebook/xmod-base-30-195k": "https://huggingface.co/facebook/xmod-base-30-195k/resolve/main/config.json",
    "facebook/xmod-base-60-125k": "https://huggingface.co/facebook/xmod-base-60-125k/resolve/main/config.json",
    "facebook/xmod-base-60-265k": "https://huggingface.co/facebook/xmod-base-60-265k/resolve/main/config.json",
    "facebook/xmod-base-75-125k": "https://huggingface.co/facebook/xmod-base-75-125k/resolve/main/config.json",
    "facebook/xmod-base-75-269k": "https://huggingface.co/facebook/xmod-base-75-269k/resolve/main/config.json",
}







class       __lowerCAmelCase   (      A						):
			UpperCamelCase        =					'''xmod'''



			def __init__(						self       :  Optional[int]			,		A       :  int=3_05_22			,		A       :  Tuple=7_68			,		A       :  Optional[Any]=12			,		A       :  Tuple=12			,		A       :  str=30_72			,		A       :  List[str]="gelu"			,		A       :  Any=0.1			,		A       :  int=0.1			,		A       :  Dict=5_12			,		A       :  Optional[Any]=2			,		A       :  Optional[Any]=0.0_2			,		A       :  List[Any]=1E-12			,		A       :  int=1			,		A       :  Tuple=0			,		A       :  Optional[Any]=2			,		A       :  int="absolute"			,		A       :  Union[str, Any]=True			,		A       :  List[Any]=None			,		A       :  Optional[Any]=False			,		A       :  List[str]=2			,		A       :  int=False			,		A       :  str=True			,		A       :  Optional[Any]=True			,		A       :  Tuple=("en_XX",)			,		A       :  Optional[int]=None			,		**A       :  List[str]			,		)       ->   Dict:



						"""simple docstring"""






						super().__init__(pad_token_id=A			,		bos_token_id=A			,		eos_token_id=A			,		**A)

						_UpperCAmelCase			=       vocab_size
						_UpperCAmelCase			=       hidden_size
						_UpperCAmelCase			=       num_hidden_layers
						_UpperCAmelCase			=       num_attention_heads
						_UpperCAmelCase			=       hidden_act
						_UpperCAmelCase			=       intermediate_size
						_UpperCAmelCase			=       hidden_dropout_prob
						_UpperCAmelCase			=       attention_probs_dropout_prob
						_UpperCAmelCase			=       max_position_embeddings
						_UpperCAmelCase			=       type_vocab_size
						_UpperCAmelCase			=       initializer_range
						_UpperCAmelCase			=       layer_norm_eps
						_UpperCAmelCase			=       position_embedding_type
						_UpperCAmelCase			=       use_cache
						_UpperCAmelCase			=       classifier_dropout
						_UpperCAmelCase			=       pre_norm
						_UpperCAmelCase			=       adapter_reduction_factor
						_UpperCAmelCase			=       adapter_layer_norm
						_UpperCAmelCase			=       adapter_reuse_layer_norm
						_UpperCAmelCase			=       ln_before_adapter
						_UpperCAmelCase			=       list(A)
						_UpperCAmelCase			=       default_language







class       __lowerCAmelCase   (      A						):



			@property
			def    _lowerCamelCase	(						self       :  Optional[Any])       ->   Mapping[str, Mapping[int, str]]:



						"""simple docstring"""






						if self.task == "multiple-choice":
									_UpperCAmelCase			=       {0: 'batch', 1: 'choice', 2: 'sequence'}
						else:
									_UpperCAmelCase			=       {0: 'batch', 1: 'sequence'}
						return OrderedDict(
						    [
						        ('input_ids', dynamic_axis),
						        ('attention_mask', dynamic_axis),
						    ])
