"""simple docstring"""


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


UpperCAmelCase__  		=						logging.get_logger(__name__)

UpperCAmelCase__  		=						{
    """funnel-transformer/small""": """https://huggingface.co/funnel-transformer/small/resolve/main/config.json""",
    """funnel-transformer/small-base""": """https://huggingface.co/funnel-transformer/small-base/resolve/main/config.json""",
    """funnel-transformer/medium""": """https://huggingface.co/funnel-transformer/medium/resolve/main/config.json""",
    """funnel-transformer/medium-base""": """https://huggingface.co/funnel-transformer/medium-base/resolve/main/config.json""",
    """funnel-transformer/intermediate""": (
        """https://huggingface.co/funnel-transformer/intermediate/resolve/main/config.json"""
    ),
    """funnel-transformer/intermediate-base""": (
        """https://huggingface.co/funnel-transformer/intermediate-base/resolve/main/config.json"""
    ),
    """funnel-transformer/large""": """https://huggingface.co/funnel-transformer/large/resolve/main/config.json""",
    """funnel-transformer/large-base""": """https://huggingface.co/funnel-transformer/large-base/resolve/main/config.json""",
    """funnel-transformer/xlarge""": """https://huggingface.co/funnel-transformer/xlarge/resolve/main/config.json""",
    """funnel-transformer/xlarge-base""": """https://huggingface.co/funnel-transformer/xlarge-base/resolve/main/config.json""",
}


class        a				(		lowerCAmelCase_   ):
    _snake_case     :  Optional[Any]     							=							'funnel'
    _snake_case     :  Tuple     							=							{
        'hidden_size': 'd_model',
        'num_attention_heads': 'n_head',
    }


    def __init__(					self	:  Any   ,				__lowerCAmelCase	:  Union[str, Any]=3_0522   ,				__lowerCAmelCase	:  str=[4, 4, 4]   ,				__lowerCAmelCase	:  List[str]=None   ,				__lowerCAmelCase	:  List[Any]=2   ,				__lowerCAmelCase	:  Optional[int]=768   ,				__lowerCAmelCase	:  int=12   ,				__lowerCAmelCase	:  str=64   ,				__lowerCAmelCase	:  List[Any]=3072   ,				__lowerCAmelCase	:  Optional[int]="gelu_new"   ,				__lowerCAmelCase	:  Union[str, Any]=0.1   ,				__lowerCAmelCase	:  str=0.1   ,				__lowerCAmelCase	:  Optional[Any]=0.0   ,				__lowerCAmelCase	:  str=0.1   ,				__lowerCAmelCase	:  Optional[int]=None   ,				__lowerCAmelCase	:  List[Any]=1e-9   ,				__lowerCAmelCase	:  Tuple="mean"   ,				__lowerCAmelCase	:  List[str]="relative_shift"   ,				__lowerCAmelCase	:  Optional[Any]=True   ,				__lowerCAmelCase	:  Union[str, Any]=True   ,				__lowerCAmelCase	:  str=True   ,				**__lowerCAmelCase	:  Optional[int]   ,				):
      _UpperCAmelCase						 =      vocab_size
      _UpperCAmelCase						 =      block_sizes
      _UpperCAmelCase						 =      [1] * len(__lowerCAmelCase					) if block_repeats is None else block_repeats
      assert len(__lowerCAmelCase					) == len(
          self.block_repeats					), "`block_sizes` and `block_repeats` should have the same length."
      _UpperCAmelCase						 =      num_decoder_layers
      _UpperCAmelCase						 =      d_model
      _UpperCAmelCase						 =      n_head
      _UpperCAmelCase						 =      d_head
      _UpperCAmelCase						 =      d_inner
      _UpperCAmelCase						 =      hidden_act
      _UpperCAmelCase						 =      hidden_dropout
      _UpperCAmelCase						 =      attention_dropout
      _UpperCAmelCase						 =      activation_dropout
      _UpperCAmelCase						 =      initializer_range
      _UpperCAmelCase						 =      initializer_std
      _UpperCAmelCase						 =      layer_norm_eps
      assert pooling_type in [
          "mean",
          "max",
      ], f'''Got {pooling_type} for `pooling_type` but only \'mean\' and \'max\' are supported.'''
      _UpperCAmelCase						 =      pooling_type
      assert attention_type in [
          "relative_shift",
          "factorized",
      ], f'''Got {attention_type} for `attention_type` but only \'relative_shift\' and \'factorized\' are supported.'''
      _UpperCAmelCase						 =      attention_type
      _UpperCAmelCase						 =      separate_cls
      _UpperCAmelCase						 =      truncate_seq
      _UpperCAmelCase						 =      pool_q_only

      super().__init__(**__lowerCAmelCase					)


    @property
    def      lowerCAmelCase_  (					self	:  Optional[int]					):
      return sum(self.block_sizes					)


    @num_hidden_layers.setter
    def      lowerCAmelCase_  (					self	:  str   ,				__lowerCAmelCase	:  int					):
      raise NotImplementedError(
          """This model does not support the setting of `num_hidden_layers`. Please set `block_sizes`."""					)


    @property
    def      lowerCAmelCase_  (					self	:  List[Any]					):
      return len(self.block_sizes					)


    @num_blocks.setter
    def      lowerCAmelCase_  (					self	:  Optional[int]   ,				__lowerCAmelCase	:  Dict					):
      raise NotImplementedError("""This model does not support the setting of `num_blocks`. Please set `block_sizes`."""					)

"""simple docstring"""


def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      abs(lowercase		)
  _UpperCAmelCase						 =      0
  while n > 0:
    res += n % 10
    n //= 10
  return res






def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      abs(lowercase		)
  return n if n < 10 else n % 10 + sum_of_digits(n // 10		)






def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  return sum(int(lowercase		) for c in str(abs(lowercase		)		)		)






def     __UpperCAmelCase					(			):







  """simple docstring"""
  from collections.abc import Callable
  from timeit import timeit

  def benchmark_a_function(lowercase   ,lowercase		) -> None:
    _UpperCAmelCase						 =      f'''{func.__name__}({value})'''
    _UpperCAmelCase						 =      timeit(f'''__main__.{call}'''   ,setup="""import __main__"""		)
    print(f'''{call:56} = {func(lowercase		)} -- {timing:.4f} seconds'''		)

  for value in (26_21_44, 11_25_89_99_06_84_26_24, 1_26_76_50_60_02_28_22_94_01_49_67_03_20_53_76):
    for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
      benchmark_a_function(lowercase   ,lowercase		)
    print()


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    benchmark()
