


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'''






				lowerCamelCase_    = '''funnel'''
				lowerCamelCase_    = {
				    '''hidden_size''': '''d_model''',
				    '''num_attention_heads''': '''n_head''',
				}
				def __init__(						self		,     lowercase=3_0_5_2_2		,     lowercase=[4, 4, 4]		,     lowercase=None		,     lowercase=2		,     lowercase=7_6_8		,     lowercase=1_2		,     lowercase=6_4		,     lowercase=3_0_7_2		,     lowercase="gelu_new"		,     lowercase=0.1		,     lowercase=0.1		,     lowercase=0.0		,     lowercase=0.1		,     lowercase=None		,     lowercase=1E-9		,     lowercase="mean"		,     lowercase="relative_shift"		,     lowercase=True		,     lowercase=True		,     lowercase=True		,     **lowercase		,     ):



						"""simple docstring"""





						A_		:    Dict         =				vocab_size
						A_		:    Union[str, Any]         =				block_sizes
						A_		:    Union[str, Any]         =				[1] * len(lowercase ) if block_repeats is None else block_repeats
						assert len(lowercase ) == len(
						    self.block_repeats ), "`block_sizes` and `block_repeats` should have the same length."
						A_		:    Optional[Any]         =				num_decoder_layers
						A_		:    Optional[int]         =				d_model
						A_		:    Union[str, Any]         =				n_head
						A_		:    Tuple         =				d_head
						A_		:    Optional[Any]         =				d_inner
						A_		:    List[Any]         =				hidden_act
						A_		:    List[str]         =				hidden_dropout
						A_		:    Optional[Any]         =				attention_dropout
						A_		:    str         =				activation_dropout
						A_		:    Union[str, Any]         =				initializer_range
						A_		:    Optional[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_		:    List[Any]         =				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_		:    str         =				attention_type
						A_		:    Optional[int]         =				separate_cls
						A_		:    List[Any]         =				truncate_seq
						A_		:    Dict         =				pool_q_only

						super().__init__(**lowercase )
				@property
				def   lowerCAmelCase_       (						self ):



						"""simple docstring"""





						return sum(self.block_sizes )
				@num_hidden_layers.setter
				def   lowerCAmelCase_       (						self		,     lowercase ):



						"""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		,     lowercase ):



						"""simple docstring"""





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







_UpperCAmelCase            =		"""ABCDEFGHIJKLMNOPQRSTUVWXYZ"""




def     UpperCamelCase						(	):
		'''simple docstring'''




		A_		:    Tuple         =				input('Enter message: '     )
		A_		:    int         =				input('Enter key [alphanumeric]: '     )
		A_		:    Optional[Any]         =				input('Encrypt/Decrypt [e/d]: '     )

		if mode.lower().startswith('e'     ):
				A_		:    List[Any]         =				'encrypt'
				A_		:    int         =				encrypt_message(__lowercase						,__lowercase     )
		elif mode.lower().startswith('d'     ):
				A_		:    Optional[Any]         =				'decrypt'
				A_		:    Dict         =				decrypt_message(__lowercase						,__lowercase     )

		print(f'''\n{mode.title()}ed message:'''     )
		print(__lowercase     )




def     UpperCamelCase						(	__lowercase						:			str						,__lowercase						:			str     ):
		'''simple docstring'''




		return translate_message(__lowercase						,__lowercase						,'encrypt'     )




def     UpperCamelCase						(	__lowercase						:			str						,__lowercase						:			str     ):
		'''simple docstring'''




		return translate_message(__lowercase						,__lowercase						,'decrypt'     )




def     UpperCamelCase						(	__lowercase						:			str						,__lowercase						:			str						,__lowercase						:			str     ):
		'''simple docstring'''




		A_		:    Tuple         =				[]
		A_		:    str         =				0
		A_		:    Optional[int]         =				key.upper()

		for symbol in message:
				A_		:    Optional[Any]         =				LETTERS.find(symbol.upper()     )
				if num != -1:
						if mode == "encrypt":
								num += LETTERS.find(key[key_index]     )
						elif mode == "decrypt":
								num -= LETTERS.find(key[key_index]     )

						num %= len(__lowercase     )

						if symbol.isupper():
								translated.append(LETTERS[num]     )
						elif symbol.islower():
								translated.append(LETTERS[num].lower()     )

						key_index += 1
						if key_index == len(__lowercase     ):
								A_		:    str         =				0
				else:
						translated.append(__lowercase     )
		return "".join(__lowercase     )


if __name__ == "__main__":
	main()






