






'''simple docstring'''







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


_A     :      List[Any]   					=logging.get_logger(__name__)

_A     :      Optional[Any]   					={}

class _lowercase     (    _lowercase		):
							a    				=	"""llama"""
							a    				=	["""past_key_values"""]




							def __init__(							self:    Optional[int]      ,							UpperCamelCase__:    Optional[int]=32_000      ,							UpperCamelCase__:    Optional[Any]=4_096      ,							UpperCamelCase__:    Tuple=11_008      ,							UpperCamelCase__:    str=32      ,							UpperCamelCase__:    Optional[int]=32      ,							UpperCamelCase__:    List[Any]=None      ,							UpperCamelCase__:    Union[str, Any]="silu"      ,							UpperCamelCase__:    Optional[Any]=2_048      ,							UpperCamelCase__:    Optional[Any]=0.02      ,							UpperCamelCase__:    Any=1e-6      ,							UpperCamelCase__:    List[Any]=True      ,							UpperCamelCase__:    int=0      ,							UpperCamelCase__:    Union[str, Any]=1      ,							UpperCamelCase__:    int=2      ,							UpperCamelCase__:    List[str]=1      ,							UpperCamelCase__:    Tuple=False      ,							UpperCamelCase__:    Dict=None      ,							**UpperCamelCase__:    List[Any]      ,							):
														lowerCamelCase__ :     List[str]	  =	vocab_size
														lowerCamelCase__ :     Optional[int]	  =	max_position_embeddings
														lowerCamelCase__ :     List[str]	  =	hidden_size
														lowerCamelCase__ :     Any	  =	intermediate_size
														lowerCamelCase__ :     List[Any]	  =	num_hidden_layers
														lowerCamelCase__ :     Union[str, Any]	  =	num_attention_heads

														# for backward compatibility
														if num_key_value_heads is None:
																					lowerCamelCase__ :     List[Any]	  =	num_attention_heads

														lowerCamelCase__ :     List[str]	  =	num_key_value_heads
														lowerCamelCase__ :     List[str]	  =	hidden_act
														lowerCamelCase__ :     Tuple	  =	initializer_range
														lowerCamelCase__ :     List[Any]	  =	rms_norm_eps
														lowerCamelCase__ :     Union[str, Any]	  =	pretraining_tp
														lowerCamelCase__ :     Union[str, Any]	  =	use_cache
														lowerCamelCase__ :     Dict	  =	rope_scaling
														self._rope_scaling_validation()

														super().__init__(
														    pad_token_id=UpperCamelCase__      ,							bos_token_id=UpperCamelCase__      ,							eos_token_id=UpperCamelCase__      ,							tie_word_embeddings=UpperCamelCase__      ,							**UpperCamelCase__      ,							)




							def 		lowerCamelCase_    (							self:    Any					):
														if self.rope_scaling is None:
																					return

														if not isinstance(self.rope_scaling      ,							UpperCamelCase__					) or len(self.rope_scaling					) != 2:
																					raise ValueError(
																					    """`rope_scaling` must be a dictionary with with two fields, `name` and `factor`, """
																					    F'''got {self.rope_scaling}'''					)
														lowerCamelCase__ :     Tuple	  =	self.rope_scaling.get("""type"""      ,							UpperCamelCase__					)
														lowerCamelCase__ :     List[Any]	  =	self.rope_scaling.get("""factor"""      ,							UpperCamelCase__					)
														if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
																					raise ValueError(
																					    F'''`rope_scaling`\'s name field must be one of [\'linear\', \'dynamic\'], got {rope_scaling_type}'''					)
														if rope_scaling_factor is None or not isinstance(UpperCamelCase__      ,							UpperCamelCase__					) or rope_scaling_factor <= 1.0:
																					raise ValueError(F'''`rope_scaling`\'s factor field must be an float > 1, got {rope_scaling_factor}'''					)









'''simple docstring'''







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

_A     :      List[str]   					=637_8137.0
_A     :      Dict   					=635_6752.31_4245
_A     :      int   					=6_378_137





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase    ,      UpperCamelCase    ,      UpperCamelCase    ,      UpperCamelCase				)				->	float:
							lowerCamelCase__ :     str	  =	(AXIS_A - AXIS_B) / AXIS_A
							lowerCamelCase__ :     Dict	  =	atan((1 - flattening) * tan(radians(UpperCamelCase				)				)				)
							lowerCamelCase__ :     Dict	  =	atan((1 - flattening) * tan(radians(UpperCamelCase				)				)				)
							lowerCamelCase__ :     Optional[Any]	  =	radians(UpperCamelCase				)
							lowerCamelCase__ :     List[Any]	  =	radians(UpperCamelCase				)
							# Equation
							lowerCamelCase__ :     Tuple	  =	sin((phi_a - phi_a) / 2				)
							lowerCamelCase__ :     List[Any]	  =	sin((lambda_a - lambda_a) / 2				)
							# Square both values
							sin_sq_phi *= sin_sq_phi
							sin_sq_lambda *= sin_sq_lambda
							lowerCamelCase__ :     Tuple	  =	sqrt(sin_sq_phi + (cos(UpperCamelCase				) * cos(UpperCamelCase				) * sin_sq_lambda)				)
							return 2 * RADIUS * asin(UpperCamelCase				)


if __name__ == "__main__":
			import doctest

			doctest.testmod()

