





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


_lowerCamelCase :    Optional[int]  							= logging.get_logger(__name__)

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


class 						lowerCamelCase       (__lowerCamelCase      ):







       """simple docstring"""




       UpperCAmelCase_      						=   "open-llama"






       def __init__( self     :					int,			_UpperCAmelCase     :					Tuple=1_0_0_0_0_0,			_UpperCAmelCase     :					Any=4_0_9_6,			_UpperCAmelCase     :					List[Any]=1_1_0_0_8,			_UpperCAmelCase     :					Optional[int]=3_2,			_UpperCAmelCase     :					Any=3_2,			_UpperCAmelCase     :					Any="silu",			_UpperCAmelCase     :					str=2_0_4_8,			_UpperCAmelCase     :					List[str]=0.02,			_UpperCAmelCase     :					Tuple=1E-6,			_UpperCAmelCase     :					Dict=True,			_UpperCAmelCase     :					Optional[Any]=0,			_UpperCAmelCase     :					Optional[Any]=1,			_UpperCAmelCase     :					Tuple=2,			_UpperCAmelCase     :					List[Any]=False,			_UpperCAmelCase     :					Any=True,			_UpperCAmelCase     :					Any=0.1,			_UpperCAmelCase     :					List[str]=0.1,			_UpperCAmelCase     :					Optional[int]=True,			_UpperCAmelCase     :					Tuple=True,			_UpperCAmelCase     :					Dict=None,			**_UpperCAmelCase     :					Dict,			)				->			int:





              """simple docstring"""
              SCREAMING_SNAKE_CASE__       :      Tuple     =						vocab_size
              SCREAMING_SNAKE_CASE__       :      List[str]     =						max_position_embeddings
              SCREAMING_SNAKE_CASE__       :      Tuple     =						hidden_size
              SCREAMING_SNAKE_CASE__       :      str     =						intermediate_size
              SCREAMING_SNAKE_CASE__       :      Tuple     =						num_hidden_layers
              SCREAMING_SNAKE_CASE__       :      List[Any]     =						num_attention_heads
              SCREAMING_SNAKE_CASE__       :      Tuple     =						hidden_act
              SCREAMING_SNAKE_CASE__       :      Any     =						initializer_range
              SCREAMING_SNAKE_CASE__       :      List[Any]     =						rms_norm_eps
              SCREAMING_SNAKE_CASE__       :      Any     =						use_cache
              SCREAMING_SNAKE_CASE__       :      Any     =						kwargs.pop(
                  "use_memorry_efficient_attention",			_UpperCAmelCase						)
              SCREAMING_SNAKE_CASE__       :      str     =						hidden_dropout_prob
              SCREAMING_SNAKE_CASE__       :      Dict     =						attention_dropout_prob
              SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						use_stable_embedding
              SCREAMING_SNAKE_CASE__       :      Any     =						shared_input_output_embedding
              SCREAMING_SNAKE_CASE__       :      Dict     =						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  A_     ( self     :					List[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}'''						)
              SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						self.rope_scaling.get("type",			_UpperCAmelCase						)
              SCREAMING_SNAKE_CASE__       :      Tuple     =						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}'''						)













from sympy import diff, lambdify, symbols
from sympy.functions import *  # noqa: F403




def _a (  SCREAMING_SNAKE_CASE__      :  str			,				SCREAMING_SNAKE_CASE__      :  complex			,				SCREAMING_SNAKE_CASE__      :  str = "x"			,				SCREAMING_SNAKE_CASE__      :  float = 10**-10			,				SCREAMING_SNAKE_CASE__      :  int = 1			,				)	->    complex:

							'''simple docstring'''






							SCREAMING_SNAKE_CASE__       :      Union[str, Any]     =						symbols(SCREAMING_SNAKE_CASE__       )
							SCREAMING_SNAKE_CASE__       :      str     =						lambdify(SCREAMING_SNAKE_CASE__			,				SCREAMING_SNAKE_CASE__       )
							SCREAMING_SNAKE_CASE__       :      int     =						lambdify(SCREAMING_SNAKE_CASE__			,				diff(SCREAMING_SNAKE_CASE__			,				SCREAMING_SNAKE_CASE__       )       )

							SCREAMING_SNAKE_CASE__       :      Any     =						starting_point

							while True:
														if diff_function(SCREAMING_SNAKE_CASE__       ) != 0:
																					SCREAMING_SNAKE_CASE__       :      Any     =						prev_guess - multiplicity * func(SCREAMING_SNAKE_CASE__       ) / diff_function(
																					    SCREAMING_SNAKE_CASE__       )
														else:
																					raise ZeroDivisionError("Could not find root"       ) from None

														# Precision is checked by comparing the difference of consecutive guesses
														if abs(next_guess - prev_guess       ) < precision:
																					return next_guess

														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						next_guess


# 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
		# Find fourth Root of 5
		print(f"The root of x**4 - 5 = 0 is {newton_raphson('x**4 -5', 0.4 +5J)}")

		# Find value of e
		print(
		    '''The root of log(y) - 1 = 0 is ''',
		    f"{newton_raphson('log(y) - 1', 2, variable='y')}",
		)

		# Exponential Roots
		print(
		    '''The root of exp(x) - 1 = 0 is''',
		    f"{newton_raphson('exp(x) - 1', 1_0, precision=0.005)}",
		)

		# Find root of cos(x)
		print(f"The root of cos(x) = 0 is {newton_raphson('cos(x)', 0)}")






