






'''simple docstring'''


from collections import OrderedDict
from typing import Mapping

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


SCREAMING_SNAKE_CASE_				      =							logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_				      =							{
    '''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 							lowerCAmelCase					(							A__   ):







   """simple docstring"""







   _A						=   '''ernie'''



   def __init__( self   ,   _A=30522   ,   _A=768   ,   _A=12   ,   _A=12   ,   _A=3072   ,   _A="gelu"   ,   _A=0.1   ,   _A=0.1   ,   _A=512   ,   _A=2   ,   _A=3   ,   _A=False   ,   _A=0.02   ,   _A=1E-1_2   ,   _A=0   ,   _A="absolute"   ,   _A=True   ,   _A=None   ,   **_A   ,   )    ->   Union[str, Any]:
    super().__init__(pad_token_id=_A   ,   **_A			)

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




class 							lowerCAmelCase					(							A__   ):







   """simple docstring"""







   @property
   def    __magic_name__    ( self			)    ->   Tuple:






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












'''simple docstring'''


import math
from timeit import timeit






def   lowerCAmelCase__			(					SCREAMING_SNAKE_CASE__		):
 __a    :	Any									=						0
 __a    :	List[Any]									=						abs(SCREAMING_SNAKE_CASE__		)
 while True:
  __a    :	int									=						n // 10
  digits += 1
  if n == 0:
   break
 return digits






def   lowerCAmelCase__			(					SCREAMING_SNAKE_CASE__		):
 return 1 if n == 0 else math.floor(math.log(abs(SCREAMING_SNAKE_CASE__		)       ,		10		) + 1		)






def   lowerCAmelCase__			(					SCREAMING_SNAKE_CASE__		):
 return len(str(abs(SCREAMING_SNAKE_CASE__		)		)		)






def   lowerCAmelCase__			(					):
 from collections.abc import Callable

 def benchmark_a_function(SCREAMING_SNAKE_CASE__       ,		SCREAMING_SNAKE_CASE__		) -> None:
  __a    :	Tuple									=						f'''{func.__name__}({value})'''
  __a    :	List[Any]									=						timeit(f'''__main__.{call}'''       ,		setup='import __main__'		)
  print(f'''{call}: {func(SCREAMING_SNAKE_CASE__		)} -- {timing} seconds'''		)

 for value in (262144, 1125899906842624, 1267650600228229401496703205376):
  for func in (num_digits, num_digits_fast, num_digits_faster):
   benchmark_a_function(SCREAMING_SNAKE_CASE__       ,		SCREAMING_SNAKE_CASE__		)
  print()


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  benchmark()




