


from collections import OrderedDict
from typing import Mapping

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


_SCREAMING_SNAKE_CASE :					str			=	logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE :					str			=	{
    """nghuyong/ernie-1.0-base-zh""": """https://huggingface.co/nghuyong/ernie-1.0-base-zh/resolve/main/config.json""",
    """nghuyong/ernie-2.0-base-en""": """https://huggingface.co/nghuyong/ernie-2.0-base-en/resolve/main/config.json""",
    """nghuyong/ernie-2.0-large-en""": """https://huggingface.co/nghuyong/ernie-2.0-large-en/resolve/main/config.json""",
    """nghuyong/ernie-3.0-base-zh""": """https://huggingface.co/nghuyong/ernie-3.0-base-zh/resolve/main/config.json""",
    """nghuyong/ernie-3.0-medium-zh""": """https://huggingface.co/nghuyong/ernie-3.0-medium-zh/resolve/main/config.json""",
    """nghuyong/ernie-3.0-mini-zh""": """https://huggingface.co/nghuyong/ernie-3.0-mini-zh/resolve/main/config.json""",
    """nghuyong/ernie-3.0-micro-zh""": """https://huggingface.co/nghuyong/ernie-3.0-micro-zh/resolve/main/config.json""",
    """nghuyong/ernie-3.0-nano-zh""": """https://huggingface.co/nghuyong/ernie-3.0-nano-zh/resolve/main/config.json""",
    """nghuyong/ernie-gram-zh""": """https://huggingface.co/nghuyong/ernie-gram-zh/resolve/main/config.json""",
    """nghuyong/ernie-health-zh""": """https://huggingface.co/nghuyong/ernie-health-zh/resolve/main/config.json""",
}

class  UpperCamelCase__ ( __lowerCamelCase			):
      a__   :     Optional[int]								=						'ernie'






      def __init__(     self					:   int,		__lowerCamelCase					:   Any=3_05_22,		__lowerCamelCase					:   List[Any]=7_68,		__lowerCamelCase					:   Optional[Any]=12,		__lowerCamelCase					:   str=12,		__lowerCamelCase					:   int=30_72,		__lowerCamelCase					:   Dict="gelu",		__lowerCamelCase					:   Dict=0.1,		__lowerCamelCase					:   List[Any]=0.1,		__lowerCamelCase					:   Optional[int]=5_12,		__lowerCamelCase					:   Tuple=2,		__lowerCamelCase					:   str=3,		__lowerCamelCase					:   str=False,		__lowerCamelCase					:   Optional[Any]=0.02,		__lowerCamelCase					:   Optional[Any]=1e-12,		__lowerCamelCase					:   Optional[int]=0,		__lowerCamelCase					:   Union[str, Any]="absolute",		__lowerCamelCase					:   Optional[int]=True,		__lowerCamelCase					:   Dict=None,		**__lowerCamelCase					:   List[Any],		)  -> List[str]:
           super().__init__(pad_token_id=__lowerCamelCase,		**__lowerCamelCase   )

           UpperCamelCase__							:  Dict								=     vocab_size
           UpperCamelCase__							:  Dict								=     hidden_size
           UpperCamelCase__							:  Dict								=     num_hidden_layers
           UpperCamelCase__							:  int								=     num_attention_heads
           UpperCamelCase__							:  List[str]								=     hidden_act
           UpperCamelCase__							:  Union[str, Any]								=     intermediate_size
           UpperCamelCase__							:  str								=     hidden_dropout_prob
           UpperCamelCase__							:  List[str]								=     attention_probs_dropout_prob
           UpperCamelCase__							:  List[str]								=     max_position_embeddings
           UpperCamelCase__							:  List[Any]								=     type_vocab_size
           UpperCamelCase__							:  Tuple								=     task_type_vocab_size
           UpperCamelCase__							:  List[str]								=     use_task_id
           UpperCamelCase__							:  Dict								=     initializer_range
           UpperCamelCase__							:  Tuple								=     layer_norm_eps
           UpperCamelCase__							:  int								=     position_embedding_type
           UpperCamelCase__							:  int								=     use_cache
           UpperCamelCase__							:  Optional[int]								=     classifier_dropout

class  UpperCamelCase__ ( __lowerCamelCase			):






      @property
      def 	__lowercase(     self					:   Dict   )  -> Mapping[str, Mapping[int, str]]:
           if self.task == "multiple-choice":
                UpperCamelCase__							:  Optional[Any]								=     {0: '''batch''', 1: '''choice''', 2: '''sequence'''}
           else:
                UpperCamelCase__							:  List[str]								=     {0: '''batch''', 1: '''sequence'''}
           return OrderedDict(
               [
                   ('''input_ids''', dynamic_axis),
                   ('''attention_mask''', dynamic_axis),
                   ('''token_type_ids''', dynamic_axis),
                   ('''task_type_ids''', dynamic_axis),
               ]   )








from typing import TYPE_CHECKING

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


_SCREAMING_SNAKE_CASE :					Optional[Any]			=	{
    """configuration_layoutlm""": ["""LAYOUTLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LayoutLMConfig""", """LayoutLMOnnxConfig"""],
    """tokenization_layoutlm""": ["""LayoutLMTokenizer"""],
}

try:
   if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _SCREAMING_SNAKE_CASE :					Dict			=	["""LayoutLMTokenizerFast"""]

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _SCREAMING_SNAKE_CASE :					List[str]			=	[
       """LAYOUTLM_PRETRAINED_MODEL_ARCHIVE_LIST""",
       """LayoutLMForMaskedLM""",
       """LayoutLMForSequenceClassification""",
       """LayoutLMForTokenClassification""",
       """LayoutLMForQuestionAnswering""",
       """LayoutLMModel""",
       """LayoutLMPreTrainedModel""",
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _SCREAMING_SNAKE_CASE :					str			=	[
       """TF_LAYOUTLM_PRETRAINED_MODEL_ARCHIVE_LIST""",
       """TFLayoutLMForMaskedLM""",
       """TFLayoutLMForSequenceClassification""",
       """TFLayoutLMForTokenClassification""",
       """TFLayoutLMForQuestionAnswering""",
       """TFLayoutLMMainLayer""",
       """TFLayoutLMModel""",
       """TFLayoutLMPreTrainedModel""",
   ]


if TYPE_CHECKING:
   from .configuration_layoutlm import LAYOUTLM_PRETRAINED_CONFIG_ARCHIVE_MAP, LayoutLMConfig, LayoutLMOnnxConfig
   from .tokenization_layoutlm import LayoutLMTokenizer

   try:
      if not is_tokenizers_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_layoutlm_fast import LayoutLMTokenizerFast

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_layoutlm import (
          LAYOUTLM_PRETRAINED_MODEL_ARCHIVE_LIST,
          LayoutLMForMaskedLM,
          LayoutLMForQuestionAnswering,
          LayoutLMForSequenceClassification,
          LayoutLMForTokenClassification,
          LayoutLMModel,
          LayoutLMPreTrainedModel,
      )
   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_layoutlm import (
          TF_LAYOUTLM_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFLayoutLMForMaskedLM,
          TFLayoutLMForQuestionAnswering,
          TFLayoutLMForSequenceClassification,
          TFLayoutLMForTokenClassification,
          TFLayoutLMMainLayer,
          TFLayoutLMModel,
          TFLayoutLMPreTrainedModel,
      )

else:
   import sys

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




