"""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 						__UpperCAmelCase    (__A     ):







			'''simple docstring'''
			_UpperCamelCase  :						Optional[Any]					     =				'funnel'
			_UpperCamelCase  :						Union[str, Any]					     =				{
			    'hidden_size': 'd_model',
			    'num_attention_heads': 'n_head',
			}





			def __init__(			self   ,      snake_case_=30_522   ,      snake_case_=[4, 4, 4]   ,      snake_case_=None   ,      snake_case_=2   ,      snake_case_=768   ,      snake_case_=12   ,      snake_case_=64   ,      snake_case_=3_072   ,      snake_case_="gelu_new"   ,      snake_case_=0.1   ,      snake_case_=0.1   ,      snake_case_=0.0   ,      snake_case_=0.1   ,      snake_case_=None   ,      snake_case_=1E-9   ,      snake_case_="mean"   ,      snake_case_="relative_shift"   ,      snake_case_=True   ,      snake_case_=True   ,      snake_case_=True   ,      **snake_case_   ,      ):







										'''simple docstring'''


										A__       :     str								=			vocab_size
										A__       :     Tuple								=			block_sizes
										A__       :     Optional[Any]								=			[1] * len(snake_case_							) if block_repeats is None else block_repeats
										assert len(snake_case_							) == len(
										    self.block_repeats							), "`block_sizes` and `block_repeats` should have the same length."
										A__       :     List[Any]								=			num_decoder_layers
										A__       :     Dict								=			d_model
										A__       :     Dict								=			n_head
										A__       :     Optional[int]								=			d_head
										A__       :     Optional[int]								=			d_inner
										A__       :     int								=			hidden_act
										A__       :     Dict								=			hidden_dropout
										A__       :     Tuple								=			attention_dropout
										A__       :     Dict								=			activation_dropout
										A__       :     Optional[Any]								=			initializer_range
										A__       :     int								=			initializer_std
										A__       :     Dict								=			layer_norm_eps
										assert pooling_type in [
										    "mean",
										    "max",
										], F'''Got {pooling_type} for `pooling_type` but only \'mean\' and \'max\' are supported.'''
										A__       :     str								=			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__       :     Dict								=			separate_cls
										A__       :     Optional[Any]								=			truncate_seq
										A__       :     str								=			pool_q_only

										super().__init__(**snake_case_							)





			@property
			def 		lowerCamelCase					(			self							):







										'''simple docstring'''


										return sum(self.block_sizes							)





			@num_hidden_layers.setter
			def 		lowerCamelCase					(			self   ,      snake_case_							):







										'''simple docstring'''


										raise NotImplementedError(
										    """This model does not support the setting of `num_hidden_layers`. Please set `block_sizes`."""							)





			@property
			def 		lowerCamelCase					(			self							):







										'''simple docstring'''


										return len(self.block_sizes							)





			@num_blocks.setter
			def 		lowerCamelCase					(			self   ,      snake_case_							):







										'''simple docstring'''


										raise NotImplementedError("""This model does not support the setting of `num_blocks`. Please set `block_sizes`."""							)






"""simple docstring"""



def  _A(		lowerCAmelCase			,  lowerCAmelCase							):
							A__       :     List[Any]								=			[1]
							for i in range(2			,  lowerCAmelCase							):
														factorials.append(factorials[-1] * i							)
							assert 0 <= k < factorials[-1] * n, "k out of bounds"

							A__       :     Union[str, Any]								=			[]
							A__       :     int								=			list(range(lowerCAmelCase							)							)

							# Find permutation
							while factorials:
														A__       :     Optional[int]								=			factorials.pop()
														A__				,							A__       :     Union[str, Any]								=			divmod(lowerCAmelCase			,  lowerCAmelCase							)
														permutation.append(elements[number]							)
														elements.remove(elements[number]							)
							permutation.append(elements[0]							)

							return permutation


if __name__ == "__main__":
				import doctest

				doctest.testmod()





