

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


A__     :   List[str]						=							logging.get_logger(__name__)

A__     :   Optional[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 				__UpperCamelCase				(					__lowercase			):
	_lowercase  :   List[Any]       				=  "funnel"
	_lowercase  :   Optional[int]       				=  {
	    "hidden_size": "d_model",
	    "num_attention_heads": "n_head",
	}







	def __init__(   self: Optional[int]  , __UpperCamelCase: List[Any]=3_05_22  , __UpperCamelCase: Dict=[4, 4, 4]  , __UpperCamelCase: List[Any]=None  , __UpperCamelCase: Tuple=2  , __UpperCamelCase: int=7_68  , __UpperCamelCase: Dict=12  , __UpperCamelCase: List[str]=64  , __UpperCamelCase: Optional[int]=30_72  , __UpperCamelCase: List[Any]="gelu_new"  , __UpperCamelCase: List[str]=0.1  , __UpperCamelCase: str=0.1  , __UpperCamelCase: Any=0.0  , __UpperCamelCase: List[str]=0.1  , __UpperCamelCase: Optional[Any]=None  , __UpperCamelCase: Optional[Any]=1E-9  , __UpperCamelCase: Optional[Any]="mean"  , __UpperCamelCase: List[str]="relative_shift"  , __UpperCamelCase: Optional[Any]=True  , __UpperCamelCase: Optional[int]=True  , __UpperCamelCase: Optional[int]=True  , **__UpperCamelCase: str  , ):

						'''simple docstring'''





						__magic_name__							=    vocab_size
						__magic_name__							=    block_sizes
						__magic_name__							=    [1] * len(_A      ) if block_repeats is None else block_repeats
						assert len(_A      ) == len(
						    self.block_repeats      ), "`block_sizes` and `block_repeats` should have the same length."
						__magic_name__							=    num_decoder_layers
						__magic_name__							=    d_model
						__magic_name__							=    n_head
						__magic_name__							=    d_head
						__magic_name__							=    d_inner
						__magic_name__							=    hidden_act
						__magic_name__							=    hidden_dropout
						__magic_name__							=    attention_dropout
						__magic_name__							=    activation_dropout
						__magic_name__							=    initializer_range
						__magic_name__							=    initializer_std
						__magic_name__							=    layer_norm_eps
						assert pooling_type in [
						    "mean",
						    "max",
						], F'Got {pooling_type} for `pooling_type` but only \'mean\' and \'max\' are supported.'
						__magic_name__							=    pooling_type
						assert attention_type in [
						    "relative_shift",
						    "factorized",
						], F'Got {attention_type} for `attention_type` but only \'relative_shift\' and \'factorized\' are supported.'
						__magic_name__							=    attention_type
						__magic_name__							=    separate_cls
						__magic_name__							=    truncate_seq
						__magic_name__							=    pool_q_only

						super().__init__(**_A      )







	@property
	def 	_SCREAMING_SNAKE_CASE							(   self: int      ):

						'''simple docstring'''





						return sum(self.block_sizes      )







	@num_hidden_layers.setter
	def 	_SCREAMING_SNAKE_CASE							(   self: List[Any]  , __UpperCamelCase: Optional[int]      ):

						'''simple docstring'''





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







	@property
	def 	_SCREAMING_SNAKE_CASE							(   self: Tuple      ):

						'''simple docstring'''





						return len(self.block_sizes      )







	@num_blocks.setter
	def 	_SCREAMING_SNAKE_CASE							(   self: List[Any]  , __UpperCamelCase: Optional[int]      ):

						'''simple docstring'''





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







from math import factorial, radians




def 					_lowercase     (				a_				:					float					,a_				:					int = 1_8					,a_				:					int = 1_0				)				->	float:




					'''simple docstring'''







					__magic_name__							=    angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0)

					# Converting from degrees to radians
					__magic_name__							=    radians(a_				)

					__magic_name__							=    angle_in_radians
					__magic_name__							=    3
					__magic_name__							=    -1

					for _ in range(a_				):
										result += (b * (angle_in_radians**a)) / factorial(a_				)

										__magic_name__							=    -b  # One positive term and the next will be negative and so on...
										a += 2  # Increased by 2 for every term.

					return round(a_					,a_				)


if __name__ == "__main__":
						__import__("doctest").testmod()




