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


UpperCAmelCase					      =							logging.get_logger(__name__)

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



class        snake_case__							(					_UpperCamelCase				):
   _SCREAMING_SNAKE_CASE						:			Tuple         =   "open-llama"



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




         '''simple docstring'''




         snake_case_  :      int  	=							vocab_size
         snake_case_  :      str  	=							max_position_embeddings
         snake_case_  :      Tuple  	=							hidden_size
         snake_case_  :      str  	=							intermediate_size
         snake_case_  :      Any  	=							num_hidden_layers
         snake_case_  :      Union[str, Any]  	=							num_attention_heads
         snake_case_  :      Optional[Any]  	=							hidden_act
         snake_case_  :      Tuple  	=							initializer_range
         snake_case_  :      int  	=							rms_norm_eps
         snake_case_  :      str  	=							use_cache
         snake_case_  :      List[Any]  	=							kwargs.pop(
             "use_memorry_efficient_attention"      ,						_UpperCamelCase )
         snake_case_  :      List[Any]  	=							hidden_dropout_prob
         snake_case_  :      str  	=							attention_dropout_prob
         snake_case_  :      List[Any]  	=							use_stable_embedding
         snake_case_  :      Optional[Any]  	=							shared_input_output_embedding
         snake_case_  :      List[str]  	=							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        UpperCAmelCase__							(					self : Optional[Any] )				->  List[str]:




         '''simple docstring'''




         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}" )
         snake_case_  :      Any  	=							self.rope_scaling.get("type"      ,						_UpperCamelCase )
         snake_case_  :      Optional[int]  	=							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'''
def 					lowerCamelCase_ ( __UpperCamelCase					:       int		)					->	bool:







     """simple docstring"""
     if num < 0:
          return False

     _A				=							num
     _A				=							0
     while num > 0:
          _A				=							rev_num * 1_0 + (num % 1_0)
          num //= 1_0

     return num_copy == rev_num


if __name__ == "__main__":
    import doctest

    doctest.testmod()





