





'''simple docstring'''




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


__SCREAMING_SNAKE_CASE     :Tuple       =				logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE     :List[str]       =				{
    '''s-JoL/Open-Llama-V1''': '''https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json''',
}







class   A_	(  __lowerCAmelCase			):
 _lowerCamelCase  : Any           =							"""open-llama"""




 def __init__(					self       :    Any	,			snake_case_       :    Any=1_0_0_0_0_0	,			snake_case_       :    Union[str, Any]=4_0_9_6	,			snake_case_       :    str=1_1_0_0_8	,			snake_case_       :    int=3_2	,			snake_case_       :    Optional[int]=3_2	,			snake_case_       :    int="silu"	,			snake_case_       :    Optional[int]=2_0_4_8	,			snake_case_       :    Optional[Any]=0.0_2	,			snake_case_       :    Tuple=1e-6	,			snake_case_       :    int=True	,			snake_case_       :    Dict=0	,			snake_case_       :    Optional[Any]=1	,			snake_case_       :    Optional[int]=2	,			snake_case_       :    Union[str, Any]=False	,			snake_case_       :    str=True	,			snake_case_       :    List[Any]=0.1	,			snake_case_       :    List[str]=0.1	,			snake_case_       :    int=True	,			snake_case_       :    List[Any]=True	,			snake_case_       :    List[str]=None	,			**snake_case_       :    str	,			):
      _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"	,			snake_case_    )
      _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=snake_case_	,			bos_token_id=snake_case_	,			eos_token_id=snake_case_	,			tie_word_embeddings=snake_case_	,			**snake_case_	,			)




 def      lowercase	(					self       :    List[str]    ):





      if self.rope_scaling is None:
           return

      if not isinstance(self.rope_scaling	,			snake_case_    ) 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"	,			snake_case_    )
      _UpperCAmelCase     							=   self.rope_scaling.get("factor"	,			snake_case_    )
      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(snake_case_	,			snake_case_    ) 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"""
def 						__a   (	_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )	->int:
  while a != 0:
    a__							,    a__:     List[str]										=	b % a, a
  return b







def 						__a   (	_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )	->int:
  if gcd(_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   ) != 1:
    a__:     Dict										=	F'mod inverse of {a!r} and {m!r} does not exist'
    raise ValueError(_SCREAMING_SNAKE_CASE   )
  a__							,    a__							,    a__:     Union[str, Any]										=	1, 0, a
  a__							,    a__							,    a__:     Any										=	0, 1, m
  while va != 0:
    a__:     int										=	ua // va
    a__							,    a__							,    a__							,    a__							,    a__							,    a__:     Any										=	(ua - q * va), (ua - q * va), (ua - q * va), va, va, va
  return ua % m


