





'''simple docstring'''



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


_SCREAMING_SNAKE_CASE					=    logging.get_logger(__name__)

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






class 							__lowercase       (      lowerCAmelCase__						):







	'''simple docstring'''

	a    :				Dict											=       "open-llama"


	def __init__(self     ,_lowerCamelCase=100000     ,_lowerCamelCase=4096     ,_lowerCamelCase=11008     ,_lowerCamelCase=32     ,_lowerCamelCase=32     ,_lowerCamelCase="silu"     ,_lowerCamelCase=2048     ,_lowerCamelCase=0.0_2     ,_lowerCamelCase=1E-6     ,_lowerCamelCase=True     ,_lowerCamelCase=0     ,_lowerCamelCase=1     ,_lowerCamelCase=2     ,_lowerCamelCase=False     ,_lowerCamelCase=True     ,_lowerCamelCase=0.1     ,_lowerCamelCase=0.1     ,_lowerCamelCase=True     ,_lowerCamelCase=True     ,_lowerCamelCase=None     ,**_lowerCamelCase     ,)							->							int:







				'''simple docstring'''





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

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


	def 						_UpperCAmelCase     (self )							->							Any:







				'''simple docstring'''





				if self.rope_scaling is None:
							return

				if not isinstance(self.rope_scaling     ,_lowerCamelCase ) 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}" )
				__lowercase										=							self.rope_scaling.get('''type'''     ,_lowerCamelCase )
				__lowercase										=							self.rope_scaling.get('''factor'''     ,_lowerCamelCase )
				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(_lowerCamelCase     ,_lowerCamelCase ) 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'''



import math




def    _lowerCAmelCase						(				lowerCamelCase_			:  int				):
			assert isinstance(lowerCamelCase_		,       lowerCamelCase_				) and (
			    number >= 0
			), "'number' must been an int and positive"

			if 1 < number < 4:
						# 2 and 3 are primes
						return True
			elif number < 2 or not number % 2:
						# Negatives, 0, 1 and all even numbers are not primes
						return False

			__lowercase										=							range(3		,       int(math.sqrt(lowerCamelCase_				) + 1				)		,       2				)
			return not any(not number % i for i in odd_numbers				)




def    _lowerCAmelCase						(				lowerCamelCase_			:  Dict		,       lowerCamelCase_			:  Any=1		,       **lowerCamelCase_			:  Tuple				):
			__lowercase										=							factor * value
			__lowercase										=							value

			while not is_prime(lowerCamelCase_				):
						value += 1 if not ("desc" in kwargs and kwargs["desc"] is True) else -1

			if value == first_value_val:
						return next_prime(value + 1		,       **lowerCamelCase_				)
			return value





