





'''simple docstring'''

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


a   	=    logging.get_logger(__name__)

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







class __a			( _snake_case      ):
   __UpperCamelCase :			List[str]						   =						'open-llama'





   def __init__(       self					:      List[Any]					,lowerCamelCase					:      Optional[Any]=10_0000					,lowerCamelCase					:      Optional[Any]=4096					,lowerCamelCase					:      Tuple=1_1008					,lowerCamelCase					:      Optional[int]=32					,lowerCamelCase					:      Tuple=32					,lowerCamelCase					:      int="silu"					,lowerCamelCase					:      Dict=2048					,lowerCamelCase					:      Optional[int]=0.02					,lowerCamelCase					:      Any=1E-6					,lowerCamelCase					:      Dict=True					,lowerCamelCase					:      List[Any]=0					,lowerCamelCase					:      Optional[Any]=1					,lowerCamelCase					:      List[str]=2					,lowerCamelCase					:      str=False					,lowerCamelCase					:      Dict=True					,lowerCamelCase					:      Tuple=0.1					,lowerCamelCase					:      Optional[int]=0.1					,lowerCamelCase					:      List[Any]=True					,lowerCamelCase					:      Optional[Any]=True					,lowerCamelCase					:      str=None					,**lowerCamelCase					:      Optional[Any]					,):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE   				=							vocab_size
      __SCREAMING_SNAKE_CASE   				=							max_position_embeddings
      __SCREAMING_SNAKE_CASE   				=							hidden_size
      __SCREAMING_SNAKE_CASE   				=							intermediate_size
      __SCREAMING_SNAKE_CASE   				=							num_hidden_layers
      __SCREAMING_SNAKE_CASE   				=							num_attention_heads
      __SCREAMING_SNAKE_CASE   				=							hidden_act
      __SCREAMING_SNAKE_CASE   				=							initializer_range
      __SCREAMING_SNAKE_CASE   				=							rms_norm_eps
      __SCREAMING_SNAKE_CASE   				=							use_cache
      __SCREAMING_SNAKE_CASE   				=							kwargs.pop(
          """use_memorry_efficient_attention"""					,lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							hidden_dropout_prob
      __SCREAMING_SNAKE_CASE   				=							attention_dropout_prob
      __SCREAMING_SNAKE_CASE   				=							use_stable_embedding
      __SCREAMING_SNAKE_CASE   				=							shared_input_output_embedding
      __SCREAMING_SNAKE_CASE   				=							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					:      Tuple     ):

      '''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}"""     )
      __SCREAMING_SNAKE_CASE   				=							self.rope_scaling.get("""type"""					,lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							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}"""     )












from __future__ import annotations

import numpy as np
from numpy import floataa
from numpy.typing import NDArray





def  __magic_name__  (				lowercase				,       lowercase				,       lowercase				,       lowercase				,       )				-> list[float]:

							"""simple docstring"""



							lowercase_				,		lowercase_	:   List[str]  				=     coefficient_matrix.shape
							lowercase_				,		lowercase_	:   Any  				=     constant_matrix.shape

							if rowsa != colsa:
														lowercase_	:   List[Any]  				=     f"""Coefficient matrix dimensions must be nxn but received {rowsa}x{colsa}"""
														raise ValueError(lowercase				)

							if colsa != 1:
														lowercase_	:   Optional[int]  				=     f"""Constant matrix must be nx1 but received {rowsa}x{colsa}"""
														raise ValueError(lowercase				)

							if rowsa != rowsa:
														lowercase_	:   Tuple  				=     (
														    """Coefficient and constant matrices dimensions must be nxn and nx1 but """
														    f"""received {rowsa}x{colsa} and {rowsa}x{colsa}"""
														)
														raise ValueError(lowercase				)

							if len(lowercase				) != rowsa:
														lowercase_	:   int  				=     (
														    """Number of initial values must be equal to number of rows in coefficient """
														    f"""matrix but received {len(lowercase				)} and {rowsa}"""
														)
														raise ValueError(lowercase				)

							if iterations <= 0:
														raise ValueError("""Iterations must be at least 1"""				)

							lowercase_	:   NDArray[floataa]  				=     np.concatenate(
							    (coefficient_matrix, constant_matrix)				,       axis=1				)

							lowercase_				,		lowercase_	:   Dict  				=     table.shape

							strictly_diagonally_dominant(lowercase				)

							# Iterates the whole matrix for given number of times
							for _ in range(lowercase				):
														lowercase_	:   str  				=     []
														for row in range(lowercase				):
																					lowercase_	:   Dict  				=     0
																					for col in range(lowercase				):
																												if col == row:
																																			lowercase_	:   Optional[Any]  				=     table[row][col]
																												elif col == cols - 1:
																																			lowercase_	:   Tuple  				=     table[row][col]
																												else:
																																			temp += (-1) * table[row][col] * init_val[col]
																					lowercase_	:   List[Any]  				=     (temp + val) / denom
																					new_val.append(lowercase				)
														lowercase_	:   Optional[int]  				=     new_val

							return [float(lowercase				) for i in new_val]





def  __magic_name__  (				lowercase				)				-> bool:

							"""simple docstring"""



							lowercase_				,		lowercase_	:   str  				=     table.shape

							lowercase_	:   str  				=     True

							for i in range(0				,       lowercase				):
														lowercase_	:   Any  				=     0
														for j in range(0				,       cols - 1				):
																					if i == j:
																												continue
																					else:
																												total += table[i][j]

														if table[i][i] <= total:
																					raise ValueError("""Coefficient matrix is not strictly diagonally dominant"""				)

							return is_diagonally_dominant


# Test Cases
if __name__ == "__main__":
							import doctest

							doctest.testmod()