


'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging


__snake_case							   =  logging.get_logger(__name__)

__snake_case							   =  {}
class      lowercase			(							A__      ):

		"""simple docstring"""

		_a									=       'llama'
		_a									=       ['past_key_values']




		def __init__(	self					,     UpperCamelCase_=32000					,     UpperCamelCase_=4096					,     UpperCamelCase_=11008					,     UpperCamelCase_=32					,     UpperCamelCase_=32					,     UpperCamelCase_=None					,     UpperCamelCase_="silu"					,     UpperCamelCase_=2048					,     UpperCamelCase_=0.02					,     UpperCamelCase_=1e-6					,     UpperCamelCase_=True					,     UpperCamelCase_=0					,     UpperCamelCase_=1					,     UpperCamelCase_=2					,     UpperCamelCase_=1					,     UpperCamelCase_=False					,     UpperCamelCase_=None					,     **UpperCamelCase_					,     ):

							'''simple docstring'''


							UpperCamelCase__     :Any							      =				vocab_size
							UpperCamelCase__     :Any							      =				max_position_embeddings
							UpperCamelCase__     :Tuple							      =				hidden_size
							UpperCamelCase__     :Dict							      =				intermediate_size
							UpperCamelCase__     :List[str]							      =				num_hidden_layers
							UpperCamelCase__     :Any							      =				num_attention_heads

							# for backward compatibility
							if num_key_value_heads is None:
												UpperCamelCase__     :List[str]							      =				num_attention_heads

							UpperCamelCase__     :Optional[Any]							      =				num_key_value_heads
							UpperCamelCase__     :Dict							      =				hidden_act
							UpperCamelCase__     :Union[str, Any]							      =				initializer_range
							UpperCamelCase__     :Tuple							      =				rms_norm_eps
							UpperCamelCase__     :Union[str, Any]							      =				pretraining_tp
							UpperCamelCase__     :Any							      =				use_cache
							UpperCamelCase__     :Union[str, Any]							      =				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 					lowerCAmelCase__       (	self							):

							'''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}'''							)
							UpperCamelCase__     :Optional[int]							      =				self.rope_scaling.get('''type'''					,     UpperCamelCase_							)
							UpperCamelCase__     :List[Any]							      =				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'''
from __future__ import annotations

from decimal import Decimal
from math import *  # noqa: F403

from sympy import diff


def     a   (    __a				,      __a				,      __a = 10**-10     )						->			float:



					'''simple docstring'''






					UpperCamelCase__     :Tuple							      =				a
					while True:
										UpperCamelCase__     :Dict							      =				Decimal(__a     ) - (
										    Decimal(eval(__a     )     ) / Decimal(eval(str(diff(__a     )     )     )     )  # noqa: S307
										)
										# This number dictates the accuracy of the answer
										if abs(eval(__a     )     ) < precision:  # noqa: S307
															return float(__a     )


# Let's Execute
if __name__ == "__main__":
		# Find root of trigonometric function
		# Find value of pi
		print(F"""The root of sin(x) = 0 is {newton_raphson('sin(x)', 2)}""")
		# Find root of polynomial
		print(F"""The root of x**2 - 5*x + 2 = 0 is {newton_raphson('x**2 - 5*x + 2', 0.4)}""")
		# Find Square Root of 5
		print(F"""The root of log(x) - 1 = 0 is {newton_raphson('log(x) - 1', 2)}""")
		# Exponential Roots
		print(F"""The root of exp(x) - 1 = 0 is {newton_raphson('exp(x) - 1', 0)}""")