

import colorsys

from PIL import Image  # type: ignore



def   __UpperCAmelCase					(      __a :     float						,__a :     float						,__a :     int      )     ->	float:

					"""simple docstring"""

					_a      :       Dict   =						x
					_a      :       Dict   =						y
					for step in range(__a      ):  # noqa: B007
										_a      :       Optional[Any]   =						a * a - b * b + x
										_a      :       Dict   =						2 * a * b + y
										_a      :       List[str]   =						a_new

										# divergence happens for all complex number with an absolute value
										# greater than 4
										if a * a + b * b > 4:
															break
					return step / (max_step - 1)



def   __UpperCAmelCase					(      __a :     float      )     ->	tuple:

					"""simple docstring"""

					if distance == 1:
										return (0, 0, 0)
					else:
										return (255, 255, 255)



def   __UpperCAmelCase					(      __a :     float      )     ->	tuple:

					"""simple docstring"""

					if distance == 1:
										return (0, 0, 0)
					else:
										return tuple(round(i * 255      ) for i in colorsys.hsv_to_rgb(__a						,1						,1      )      )



def   __UpperCAmelCase					(      __a :     int = 800						,__a :     int = 600						,__a :     float = -0.6						,__a :     float = 0						,__a :     float = 3.2						,__a :     int = 50						,__a :     bool = True						,)     ->	Image.Image:

					"""simple docstring"""

					_a      :       List[str]   =						Image.new('''RGB'''						,(image_width, image_height)      )
					_a      :       List[Any]   =						img.load()

					# loop through the image-coordinates
					for image_x in range(__a      ):
										for image_y in range(__a      ):
															# determine the figure-coordinates based on the image-coordinates
															_a      :       List[Any]   =						figure_width / image_width * image_height
															_a      :       Dict   =						figure_center_x + (image_x / image_width - 0.5) * figure_width
															_a      :       Dict   =						figure_center_y + (image_y / image_height - 0.5) * figure_height

															_a      :       List[str]   =						get_distance(__a						,__a						,__a      )

															# color the corresponding pixel based on the selected coloring-function
															if use_distance_color_coding:
																				_a      :       Optional[Any]   =						get_color_coded_rgb(__a      )
															else:
																				_a      :       Optional[int]   =						get_black_and_white_rgb(__a      )

					return img


if __name__ == "__main__":
			import doctest

			doctest.testmod()

			# colored version, full figure
			a__												=						get_image()

			# uncomment for colored version, different section, zoomed in
			# img = get_image(figure_center_x = -0.6, figure_center_y = -0.4,
			# figure_width = 0.8)

			# uncomment for black and white version, full figure
			# img = get_image(use_distance_color_coding = False)

			# uncomment to save the image
			# img.save("mandelbrot.png")

			img.show()






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


a__												=						logging.get_logger(__name__)

a__												=						{
    '''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  ):
							"""simple docstring"""







							UpperCAmelCase__			:		Optional[int]             =       "funnel"
							UpperCAmelCase__			:		Tuple             =       {
							    "hidden_size": "d_model",
							    "num_attention_heads": "n_head",
							}


							def __init__(     self			,				_a=3_0_5_2_2			,				_a=[4, 4, 4]			,				_a=None			,				_a=2			,				_a=7_6_8			,				_a=1_2			,				_a=6_4			,				_a=3_0_7_2			,				_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			,				)       ->       List[Any]:
												_a      :       Optional[int]   =						vocab_size
												_a      :       Dict   =						block_sizes
												_a      :       Optional[int]   =						[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."
												_a      :       int   =						num_decoder_layers
												_a      :       List[str]   =						d_model
												_a      :       Optional[Any]   =						n_head
												_a      :       Tuple   =						d_head
												_a      :       Dict   =						d_inner
												_a      :       List[str]   =						hidden_act
												_a      :       int   =						hidden_dropout
												_a      :       Union[str, Any]   =						attention_dropout
												_a      :       Tuple   =						activation_dropout
												_a      :       Optional[Any]   =						initializer_range
												_a      :       Dict   =						initializer_std
												_a      :       Union[str, Any]   =						layer_norm_eps
												assert pooling_type in [
												    "mean",
												    "max",
												], F"""Got {pooling_type} for `pooling_type` but only 'mean' and 'max' are supported."""
												_a      :       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      :       Optional[Any]   =						attention_type
												_a      :       int   =						separate_cls
												_a      :       Tuple   =						truncate_seq
												_a      :       List[Any]   =						pool_q_only

												super().__init__(**_a			)


							@property
							def 							__lowercase							(     self			)       ->       Tuple:
												return sum(self.block_sizes			)


							@num_hidden_layers.setter
							def 							__lowercase							(     self			,				_a			)       ->       List[str]:
												raise NotImplementedError(
												    '''This model does not support the setting of `num_hidden_layers`. Please set `block_sizes`.'''			)


							@property
							def 							__lowercase							(     self			)       ->       Optional[int]:
												return len(self.block_sizes			)




							@num_blocks.setter
							def 							__lowercase							(     self			,				_a			)       ->       Dict:
												raise NotImplementedError('''This model does not support the setting of `num_blocks`. Please set `block_sizes`.'''			)



