




'''simple docstring'''





from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxSeqaSeqConfigWithPast
from ...utils import logging


UpperCAmelCase_		:				Any									=     logging.get_logger(__name__)

UpperCAmelCase_		:				Any									=     {
    "google/umt5-small": "https://huggingface.co/google/umt5-small/resolve/main/config.json",
    # See all umt5 models at https://huggingface.co/models?filter=umt5
}




class 		__A      (			lowercase__			):
						UpperCamelCase     						=					"""umt5"""
						UpperCamelCase     						=					["""past_key_values"""]

						def __init__(		self   :Dict    , __snake_case   :str=25_01_12    , __snake_case   :Tuple=5_12    , __snake_case   :str=64    , __snake_case   :List[Any]=10_24    , __snake_case   :Dict=8    , __snake_case   :List[str]=None    , __snake_case   :List[str]=6    , __snake_case   :Dict=32    , __snake_case   :Optional[int]=1_28    , __snake_case   :int=0.1    , __snake_case   :Dict=1E-6    , __snake_case   :List[str]=1.0    , __snake_case   :int="gated-gelu"    , __snake_case   :List[str]=True    , __snake_case   :Optional[int]=True    , __snake_case   :Optional[int]="T5Tokenizer"    , __snake_case   :List[str]=True    , __snake_case   :Any=0    , __snake_case   :int=1    , __snake_case   :List[Any]=0    , **__snake_case   :List[Any]    , ):
										'''simple docstring'''

										super().__init__(
										    is_encoder_decoder=__lowercase    , tokenizer_class=__lowercase    , tie_word_embeddings=__lowercase    , pad_token_id=__lowercase    , eos_token_id=__lowercase    , decoder_start_token_id=__lowercase    , **__lowercase    , )
										__magic_name__	:	List[str]								=vocab_size
										__magic_name__	:	Optional[Any]								=d_model
										__magic_name__	:	List[str]								=d_kv
										__magic_name__	:	Dict								=d_ff
										__magic_name__	:	str								=num_layers
										__magic_name__	:	List[Any]								=(
										    num_decoder_layers if num_decoder_layers is not None else self.num_layers
										)  # default = symmetry
										__magic_name__	:	int								=num_heads
										__magic_name__	:	List[str]								=relative_attention_num_buckets
										__magic_name__	:	Union[str, Any]								=relative_attention_max_distance
										__magic_name__	:	Any								=dropout_rate
										__magic_name__	:	Optional[Any]								=layer_norm_epsilon
										__magic_name__	:	int								=initializer_factor
										__magic_name__	:	int								=feed_forward_proj
										__magic_name__	:	List[Any]								=use_cache

										__magic_name__	:	List[Any]								=self.feed_forward_proj.split("""-""" )
										__magic_name__	:	int								=act_info[-1]
										__magic_name__	:	Any								=act_info[0] == """gated"""

										if len(__lowercase ) > 1 and act_info[0] != "gated" or len(__lowercase ) > 2:
														raise ValueError(
														    f"`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer."
														    """Please make sure `feed_forward_proj` is of the format `gated-{ACT_FN}` or `{ACT_FN}`, e.g. """
														    """'gated-gelu' or 'relu'""" )

										if feed_forward_proj == "gated-gelu":
														__magic_name__	:	int								="""gelu_new"""

						@property
						def     A__						(		self   :int ):
										'''simple docstring'''

										return self.d_model

						@property
						def     A__						(		self   :int ):
										'''simple docstring'''

										return self.num_heads


						@property
						def     A__						(		self   :str ):
										'''simple docstring'''

										return self.num_layers




class 		__A      (			lowercase__			):

						@property
						# Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.inputs
						def     A__						(		self   :Dict ):
										'''simple docstring'''

										__magic_name__	:	Optional[Any]								={
										    """input_ids""": {0: """batch""", 1: """encoder_sequence"""},
										    """attention_mask""": {0: """batch""", 1: """encoder_sequence"""},
										}
										if self.use_past:
														__magic_name__	:	Union[str, Any]								="""past_encoder_sequence + sequence"""
														__magic_name__	:	Optional[Any]								={0: """batch"""}
														__magic_name__	:	int								={0: """batch""", 1: """past_decoder_sequence + sequence"""}
										else:
														__magic_name__	:	List[str]								={0: """batch""", 1: """decoder_sequence"""}
														__magic_name__	:	Union[str, Any]								={0: """batch""", 1: """decoder_sequence"""}

										if self.use_past:
														self.fill_with_past_key_values_(__lowercase    , direction="""inputs""" )

										return common_inputs

						@property
						# Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.default_onnx_opset
						def     A__						(		self   :Optional[Any] ):
										'''simple docstring'''

										return 13


						@property
						def     A__						(		self   :Optional[int] ):
										'''simple docstring'''

										return 5E-4










from math import atan, cos, radians, sin, tan

from .haversine_distance import haversine_distance

UpperCAmelCase_		:				Dict									=     637_8137.0
UpperCAmelCase_		:				List[Any]									=     635_6752.31_4245
UpperCAmelCase_		:				List[str]									=     6378137




def 		lowerCAmelCase_   (	lowerCamelCase	,     lowerCamelCase	,     lowerCamelCase	,     lowerCamelCase   ):
				__magic_name__	:	str								=(AXIS_A - AXIS_B) / AXIS_A
				# Parametric latitudes
				# https://en.wikipedia.org/wiki/Latitude#Parametric_(or_reduced)_latitude
				__magic_name__	:	str								=atan((1 - flattening) * tan(radians(lowerCamelCase   )   )   )
				__magic_name__	:	List[Any]								=atan((1 - flattening) * tan(radians(lowerCamelCase   )   )   )

				# Compute central angle between two points
				# using haversine theta. sigma =  haversine_distance / equatorial radius
				__magic_name__	:	List[Any]								=haversine_distance(lowerCamelCase	,     lowerCamelCase	,     lowerCamelCase	,     lowerCamelCase   ) / EQUATORIAL_RADIUS

				# Intermediate P and Q values
				__magic_name__	:	Tuple								=(b_lata + b_lata) / 2
				__magic_name__	:	int								=(b_lata - b_lata) / 2

				# Intermediate X value
				# X = (sigma - sin(sigma)) * sin^2Pcos^2Q / cos^2(sigma/2)
				__magic_name__	:	Optional[int]								=(sin(lowerCamelCase   ) ** 2) * (cos(lowerCamelCase   ) ** 2)
				__magic_name__	:	Any								=cos(sigma / 2   ) ** 2
				__magic_name__	:	List[Any]								=(sigma - sin(lowerCamelCase   )) * (x_numerator / x_demonimator)

				# Intermediate Y value
				# Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
				__magic_name__	:	Any								=(cos(lowerCamelCase   ) ** 2) * (sin(lowerCamelCase   ) ** 2)
				__magic_name__	:	Optional[Any]								=sin(sigma / 2   ) ** 2
				__magic_name__	:	str								=(sigma + sin(lowerCamelCase   )) * (y_numerator / y_denominator)

				return EQUATORIAL_RADIUS * (sigma - ((flattening / 2) * (x_value + y_value)))


if __name__ == "__main__":
							import doctest

							doctest.testmod()




