




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


snake_case__			:    Tuple			     =      logging.get_logger(__name__)

snake_case__			:    Optional[int]			     =      {
    '''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      snake_case	(						UpperCAmelCase__				):


   '''simple docstring'''







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




   def __init__(       self  :						List[Any]    ,     lowerCamelCase_  :						Tuple=5_0265    ,     lowerCamelCase_  :						Optional[Any]=1024    ,     lowerCamelCase_  :						Dict=12    ,     lowerCamelCase_  :						Tuple=16    ,     lowerCamelCase_  :						Any=4096    ,     lowerCamelCase_  :						List[str]="gelu"    ,     lowerCamelCase_  :						Union[str, Any]=512    ,     lowerCamelCase_  :						Dict=0.1    ,     lowerCamelCase_  :						List[Any]=0.0    ,     lowerCamelCase_  :						Optional[int]=0.0    ,     lowerCamelCase_  :						Dict=2    ,     lowerCamelCase_  :						Union[str, Any]=0.02    ,     lowerCamelCase_  :						Tuple=0.0    ,     lowerCamelCase_  :						Optional[Any]=True    ,     lowerCamelCase_  :						int=False    ,     lowerCamelCase_  :						Tuple=True    ,     lowerCamelCase_  :						str=True    ,     lowerCamelCase_  :						Optional[Any]=1    ,     lowerCamelCase_  :						int=0    ,     lowerCamelCase_  :						Optional[Any]=2    ,     **lowerCamelCase_  :						List[Any]    ,     )       ->str:
     '''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_    ,     )





'''simple docstring'''




from typing import TYPE_CHECKING

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


__UpperCAmelCase					={
    "configuration_mobilebert": [
        "MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "MobileBertConfig",
        "MobileBertOnnxConfig",
    ],
    "tokenization_mobilebert": ["MobileBertTokenizer"],
}

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase					=["MobileBertTokenizerFast"]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase					=[
      "MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
      "MobileBertForMaskedLM",
      "MobileBertForMultipleChoice",
      "MobileBertForNextSentencePrediction",
      "MobileBertForPreTraining",
      "MobileBertForQuestionAnswering",
      "MobileBertForSequenceClassification",
      "MobileBertForTokenClassification",
      "MobileBertLayer",
      "MobileBertModel",
      "MobileBertPreTrainedModel",
      "load_tf_weights_in_mobilebert",
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase					=[
      "TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
      "TFMobileBertForMaskedLM",
      "TFMobileBertForMultipleChoice",
      "TFMobileBertForNextSentencePrediction",
      "TFMobileBertForPreTraining",
      "TFMobileBertForQuestionAnswering",
      "TFMobileBertForSequenceClassification",
      "TFMobileBertForTokenClassification",
      "TFMobileBertMainLayer",
      "TFMobileBertModel",
      "TFMobileBertPreTrainedModel",
  ]


if TYPE_CHECKING:
  from .configuration_mobilebert import (
      MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
      MobileBertConfig,
      MobileBertOnnxConfig,
  )
  from .tokenization_mobilebert import MobileBertTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_mobilebert_fast import MobileBertTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_mobilebert import (
        MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        MobileBertForMaskedLM,
        MobileBertForMultipleChoice,
        MobileBertForNextSentencePrediction,
        MobileBertForPreTraining,
        MobileBertForQuestionAnswering,
        MobileBertForSequenceClassification,
        MobileBertForTokenClassification,
        MobileBertLayer,
        MobileBertModel,
        MobileBertPreTrainedModel,
        load_tf_weights_in_mobilebert,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_mobilebert import (
        TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFMobileBertForMaskedLM,
        TFMobileBertForMultipleChoice,
        TFMobileBertForNextSentencePrediction,
        TFMobileBertForPreTraining,
        TFMobileBertForQuestionAnswering,
        TFMobileBertForSequenceClassification,
        TFMobileBertForTokenClassification,
        TFMobileBertMainLayer,
        TFMobileBertModel,
        TFMobileBertPreTrainedModel,
    )

else:
  import sys

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