

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


A_ :				Dict						 =    logging.get_logger(__name__)

A_ :				Any						 =    {
    '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		(__magic_name__       ):


     '''simple docstring'''






     UpperCAmelCase__:     Union[str, Any]													= '''funnel'''
     UpperCAmelCase__:     Any													= {
         '''hidden_size''': '''d_model''',
         '''num_attention_heads''': '''n_head''',
     }






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

      super().__init__(**_UpperCAmelCase    )






     @property
     def 						__A    (				self    ):
      return sum(self.block_sizes    )






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






     @property
     def 						__A    (				self    ):
      return len(self.block_sizes    )






     @num_blocks.setter
     def 						__A    (				self					, A__    ):
      raise NotImplementedError("""This model does not support the setting of `num_blocks`. Please set `block_sizes`."""    )






from functools import lru_cache

@lru_cache
def 		UpperCamelCase      (lowercase_:				int      )  ->   int:
	if num < 0:
		raise ValueError("""Number should not be negative."""      )

	return 1 if num in (0, 1) else num * factorial(num - 1      )


if __name__ == "__main__":
	import doctest

	doctest.testmod()



