


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


A      = logging.get_logger(__name__)

A      = {
    "s-JoL/Open-Llama-V1": "https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json",
}


class     lowercase__  (					a__		):
  A__=  'open-llama'






  def __init__(					self      :					int		,						_lowercase      :					List[str]=10_00_00		,						_lowercase      :					Optional[Any]=40_96		,						_lowercase      :					Tuple=1_10_08		,						_lowercase      :					Optional[Any]=32		,						_lowercase      :					List[str]=32		,						_lowercase      :					List[str]="silu"		,						_lowercase      :					Optional[Any]=20_48		,						_lowercase      :					str=0.0_2		,						_lowercase      :					int=1E-6		,						_lowercase      :					str=True		,						_lowercase      :					Tuple=0		,						_lowercase      :					int=1		,						_lowercase      :					List[Any]=2		,						_lowercase      :					Tuple=False		,						_lowercase      :					List[str]=True		,						_lowercase      :					Tuple=0.1		,						_lowercase      :					List[str]=0.1		,						_lowercase      :					Optional[Any]=True		,						_lowercase      :					Optional[Any]=True		,						_lowercase      :					Optional[Any]=None		,						**_lowercase      :					Optional[int]		,						):




         """simple docstring"""







         UpperCAmelCase__										=     vocab_size
         UpperCAmelCase__										=     max_position_embeddings
         UpperCAmelCase__										=     hidden_size
         UpperCAmelCase__										=     intermediate_size
         UpperCAmelCase__										=     num_hidden_layers
         UpperCAmelCase__										=     num_attention_heads
         UpperCAmelCase__										=     hidden_act
         UpperCAmelCase__										=     initializer_range
         UpperCAmelCase__										=     rms_norm_eps
         UpperCAmelCase__										=     use_cache
         UpperCAmelCase__										=     kwargs.pop(
             "use_memorry_efficient_attention"		,						_A )
         UpperCAmelCase__										=     hidden_dropout_prob
         UpperCAmelCase__										=     attention_dropout_prob
         UpperCAmelCase__										=     use_stable_embedding
         UpperCAmelCase__										=     shared_input_output_embedding
         UpperCAmelCase__										=     rope_scaling
         self._rope_scaling_validation()

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






  def 			_UpperCAmelCase  (					self      :					Any ):




         """simple docstring"""







         if self.rope_scaling is None:
                return

         if not isinstance(self.rope_scaling		,						_A ) 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}""" )
         UpperCAmelCase__										=     self.rope_scaling.get("type"		,						_A )
         UpperCAmelCase__										=     self.rope_scaling.get("factor"		,						_A )
         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(_A		,						_A ) or rope_scaling_factor <= 1.0:
                raise ValueError(F"""`rope_scaling`'s factor field must be an float > 1, got {rope_scaling_factor}""" )









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

from .haversine_distance import haversine_distance

A      = 6378137.0
A      = 6356752.314245
A      = 637_8137





def __UpperCAmelCase       (		__A ,						__A ,						__A ,						__A			)						->					float:



       '''simple docstring'''





       UpperCAmelCase__										=     (AXIS_A - AXIS_B) / AXIS_A
       # Parametric latitudes
       # https://en.wikipedia.org/wiki/Latitude#Parametric_(or_reduced)_latitude
       UpperCAmelCase__										=     atan((1 - flattening) * tan(radians(__A			)			)			)
       UpperCAmelCase__										=     atan((1 - flattening) * tan(radians(__A			)			)			)

       # Compute central angle between two points
       # using haversine theta. sigma =  haversine_distance / equatorial radius
       UpperCAmelCase__										=     haversine_distance(__A ,						__A ,						__A ,						__A			) / EQUATORIAL_RADIUS

       # Intermediate P and Q values
       UpperCAmelCase__										=     (b_lata + b_lata) / 2
       UpperCAmelCase__										=     (b_lata - b_lata) / 2

       # Intermediate X value
       # X = (sigma - sin(sigma)) * sin^2Pcos^2Q / cos^2(sigma/2)
       UpperCAmelCase__										=     (sin(__A			) ** 2) * (cos(__A			) ** 2)
       UpperCAmelCase__										=     cos(sigma / 2			) ** 2
       UpperCAmelCase__										=     (sigma - sin(__A			)) * (x_numerator / x_demonimator)

       # Intermediate Y value
       # Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
       UpperCAmelCase__										=     (cos(__A			) ** 2) * (sin(__A			) ** 2)
       UpperCAmelCase__										=     sin(sigma / 2			) ** 2
       UpperCAmelCase__										=     (sigma + sin(__A			)) * (y_numerator / y_denominator)

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


if __name__ == "__main__":
    import doctest

    doctest.testmod()





