

'''simple docstring'''





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


A_	= logging.get_logger(__name__)

A_	= {}


class  UpperCAmelCase (							UpperCAmelCase__    ):

		'''simple docstring'''






		SCREAMING_SNAKE_CASE_           =					'llama'
		SCREAMING_SNAKE_CASE_           =					['past_key_values']
		def __init__(					self   ,			SCREAMING_SNAKE_CASE_=32000   ,			SCREAMING_SNAKE_CASE_=4096   ,			SCREAMING_SNAKE_CASE_=11008   ,			SCREAMING_SNAKE_CASE_=32   ,			SCREAMING_SNAKE_CASE_=32   ,			SCREAMING_SNAKE_CASE_=None   ,			SCREAMING_SNAKE_CASE_="silu"   ,			SCREAMING_SNAKE_CASE_=2048   ,			SCREAMING_SNAKE_CASE_=0.02   ,			SCREAMING_SNAKE_CASE_=1E-6   ,			SCREAMING_SNAKE_CASE_=True   ,			SCREAMING_SNAKE_CASE_=0   ,			SCREAMING_SNAKE_CASE_=1   ,			SCREAMING_SNAKE_CASE_=2   ,			SCREAMING_SNAKE_CASE_=1   ,			SCREAMING_SNAKE_CASE_=False   ,			SCREAMING_SNAKE_CASE_=None   ,			**SCREAMING_SNAKE_CASE_   ,			)  ->     List[Any]:






							'''simple docstring'''



							lowerCamelCase_  				=      vocab_size
							lowerCamelCase_  				=      max_position_embeddings
							lowerCamelCase_  				=      hidden_size
							lowerCamelCase_  				=      intermediate_size
							lowerCamelCase_  				=      num_hidden_layers
							lowerCamelCase_  				=      num_attention_heads

							# for backward compatibility
							if num_key_value_heads is None:
												lowerCamelCase_  				=      num_attention_heads

							lowerCamelCase_  				=      num_key_value_heads
							lowerCamelCase_  				=      hidden_act
							lowerCamelCase_  				=      initializer_range
							lowerCamelCase_  				=      rms_norm_eps
							lowerCamelCase_  				=      pretraining_tp
							lowerCamelCase_  				=      use_cache
							lowerCamelCase_  				=      rope_scaling
							self._rope_scaling_validation()

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






		def 			UpperCamelCase(					self		)  ->     int:






							'''simple docstring'''



							if self.rope_scaling is None:
												return

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







import math
import sys

def  __SCREAMING_SNAKE_CASE		(			lowerCamelCase_:							int ):
						"""simple docstring"""






						if number != int(lowerCamelCase_ ):
												raise ValueError("the value of input must be a natural number" )
						if number < 0:
												raise ValueError("the value of input must not be a negative number" )
						if number == 0:
												return 1
						snake_case   :			List[str]						    = [-1] * (number + 1)
						snake_case   :			str						    = 0
						for i in range(1     ,		number + 1 ):
												snake_case   :			Tuple						    = sys.maxsize
												snake_case   :			Optional[Any]						    = int(math.sqrt(lowerCamelCase_ ) )
												for j in range(1     ,		root + 1 ):
																		snake_case   :			List[str]						    = 1 + answers[i - (j**2)]
																		snake_case   :			List[str]						    = min(lowerCamelCase_     ,		lowerCamelCase_ )
												snake_case   :			Dict						    = answer
						return answers[number]


if __name__ == "__main__":
			import doctest

			doctest.testmod()



