

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


a		=logging.get_logger(__name__)

a		={
    """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_		(       SCREAMING_SNAKE_CASE				):
							_UpperCAmelCase    :  Tuple						      =      '''trocr'''
							_UpperCAmelCase    :  int						      =      ['''past_key_values''']
							_UpperCAmelCase    :  Any						      =      {
							    '''num_attention_heads''': '''decoder_attention_heads''',
							    '''hidden_size''': '''d_model''',
							    '''num_hidden_layers''': '''decoder_layers''',
							}
							def __init__(		self		:			Optional[Any]   ,SCREAMING_SNAKE_CASE__		:			str=5_0_2_6_5   ,SCREAMING_SNAKE_CASE__		:			int=1_0_2_4   ,SCREAMING_SNAKE_CASE__		:			List[str]=1_2   ,SCREAMING_SNAKE_CASE__		:			str=1_6   ,SCREAMING_SNAKE_CASE__		:			Union[str, Any]=4_0_9_6   ,SCREAMING_SNAKE_CASE__		:			str="gelu"   ,SCREAMING_SNAKE_CASE__		:			Optional[int]=5_1_2   ,SCREAMING_SNAKE_CASE__		:			Tuple=0.1   ,SCREAMING_SNAKE_CASE__		:			Tuple=0.0   ,SCREAMING_SNAKE_CASE__		:			str=0.0   ,SCREAMING_SNAKE_CASE__		:			Any=2   ,SCREAMING_SNAKE_CASE__		:			Any=0.02   ,SCREAMING_SNAKE_CASE__		:			Tuple=0.0   ,SCREAMING_SNAKE_CASE__		:			List[str]=True   ,SCREAMING_SNAKE_CASE__		:			Any=False   ,SCREAMING_SNAKE_CASE__		:			List[str]=True   ,SCREAMING_SNAKE_CASE__		:			str=True   ,SCREAMING_SNAKE_CASE__		:			int=1   ,SCREAMING_SNAKE_CASE__		:			str=0   ,SCREAMING_SNAKE_CASE__		:			List[str]=2   ,**SCREAMING_SNAKE_CASE__		:			int   ,):
								__lowerCamelCase				:				Optional[Any]					       = vocab_size
								__lowerCamelCase				:				Dict					       = d_model
								__lowerCamelCase				:				Union[str, Any]					       = decoder_layers
								__lowerCamelCase				:				Optional[int]					       = decoder_attention_heads
								__lowerCamelCase				:				str					       = decoder_ffn_dim
								__lowerCamelCase				:				Optional[Any]					       = activation_function
								__lowerCamelCase				:				List[Any]					       = max_position_embeddings
								__lowerCamelCase				:				Dict					       = dropout
								__lowerCamelCase				:				Any					       = attention_dropout
								__lowerCamelCase				:				List[str]					       = activation_dropout
								__lowerCamelCase				:				Optional[Any]					       = init_std
								__lowerCamelCase				:				Tuple					       = decoder_layerdrop
								__lowerCamelCase				:				Dict					       = use_cache
								__lowerCamelCase				:				Dict					       = scale_embedding
								__lowerCamelCase				:				List[str]					       = use_learned_position_embeddings
								__lowerCamelCase				:				int					       = layernorm_embedding

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











from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


UpperCAmelCase	:	Any		     =       {
    """configuration_convbert""": ["""CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ConvBertConfig""", """ConvBertOnnxConfig"""],
    """tokenization_convbert""": ["""ConvBertTokenizer"""],
}

try:
     if not is_tokenizers_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     UpperCAmelCase	:	List[Any]		     =       ["""ConvBertTokenizerFast"""]

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     UpperCAmelCase	:	List[str]		     =       [
         """CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
         """ConvBertForMaskedLM""",
         """ConvBertForMultipleChoice""",
         """ConvBertForQuestionAnswering""",
         """ConvBertForSequenceClassification""",
         """ConvBertForTokenClassification""",
         """ConvBertLayer""",
         """ConvBertModel""",
         """ConvBertPreTrainedModel""",
         """load_tf_weights_in_convbert""",
     ]


try:
     if not is_tf_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     UpperCAmelCase	:	Union[str, Any]		     =       [
         """TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
         """TFConvBertForMaskedLM""",
         """TFConvBertForMultipleChoice""",
         """TFConvBertForQuestionAnswering""",
         """TFConvBertForSequenceClassification""",
         """TFConvBertForTokenClassification""",
         """TFConvBertLayer""",
         """TFConvBertModel""",
         """TFConvBertPreTrainedModel""",
     ]


if TYPE_CHECKING:
     from .configuration_convbert import CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, ConvBertConfig, ConvBertOnnxConfig
     from .tokenization_convbert import ConvBertTokenizer

     try:
          if not is_tokenizers_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .tokenization_convbert_fast import ConvBertTokenizerFast

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_convbert import (
              CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
              ConvBertForMaskedLM,
              ConvBertForMultipleChoice,
              ConvBertForQuestionAnswering,
              ConvBertForSequenceClassification,
              ConvBertForTokenClassification,
              ConvBertLayer,
              ConvBertModel,
              ConvBertPreTrainedModel,
              load_tf_weights_in_convbert,
          )

     try:
          if not is_tf_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_tf_convbert import (
              TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
              TFConvBertForMaskedLM,
              TFConvBertForMultipleChoice,
              TFConvBertForQuestionAnswering,
              TFConvBertForSequenceClassification,
              TFConvBertForTokenClassification,
              TFConvBertLayer,
              TFConvBertModel,
              TFConvBertPreTrainedModel,
          )


else:
     import sys

     UpperCAmelCase	:	Union[str, Any]		     =       _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)






