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


a=  logging.get_logger(__name__)

a=  {
    '''tiiuae/falcon-40b''': '''https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json''',
    '''tiiuae/falcon-7b''': '''https://huggingface.co/tiiuae/falcon-7b/resolve/main/config.json''',
}






class 			__lowercase		(						lowercase__						):







     """simple docstring"""






     SCREAMING_SNAKE_CASE__		   =						"""falcon"""
     SCREAMING_SNAKE_CASE__		   =						["""past_key_values"""]







     def __init__(		self     ,			_lowerCamelCase=6_5_0_2_4     ,			_lowerCamelCase=4_5_4_4     ,			_lowerCamelCase=3_2     ,			_lowerCamelCase=7_1     ,			_lowerCamelCase=1E-5     ,			_lowerCamelCase=0.0_2     ,			_lowerCamelCase=True     ,			_lowerCamelCase=0.0     ,			_lowerCamelCase=0.0     ,			_lowerCamelCase=None     ,			_lowerCamelCase=False     ,			_lowerCamelCase=False     ,			_lowerCamelCase=True     ,			_lowerCamelCase=True     ,			_lowerCamelCase=False     ,			_lowerCamelCase=1_1     ,			_lowerCamelCase=1_1     ,			**_lowerCamelCase     ,			):
         __UpperCamelCase	:	List[str]		    =  vocab_size
         # Backward compatibility with n_embed kwarg
         __UpperCamelCase	:	str		    =  kwargs.pop('n_embed'     ,			__lowercase    )
         __UpperCamelCase	:	List[Any]		    =  hidden_size if n_embed is None else n_embed
         __UpperCamelCase	:	str		    =  num_hidden_layers
         __UpperCamelCase	:	int		    =  num_attention_heads
         __UpperCamelCase	:	str		    =  layer_norm_epsilon
         __UpperCamelCase	:	Dict		    =  initializer_range
         __UpperCamelCase	:	List[str]		    =  use_cache
         __UpperCamelCase	:	Optional[Any]		    =  hidden_dropout
         __UpperCamelCase	:	str		    =  attention_dropout

         __UpperCamelCase	:	List[str]		    =  bos_token_id
         __UpperCamelCase	:	Union[str, Any]		    =  eos_token_id
         __UpperCamelCase	:	Optional[int]		    =  num_attention_heads if num_kv_heads is None else num_kv_heads
         __UpperCamelCase	:	Tuple		    =  alibi
         __UpperCamelCase	:	List[Any]		    =  new_decoder_architecture
         __UpperCamelCase	:	str		    =  multi_query  # Ignored when new_decoder_architecture is True
         __UpperCamelCase	:	Dict		    =  parallel_attn
         __UpperCamelCase	:	Dict		    =  bias

         super().__init__(bos_token_id=__lowercase     ,			eos_token_id=__lowercase     ,			**__lowercase    )







     @property
     def lowerCAmelCase     (		self    ):
         return self.hidden_size // self.num_attention_heads







     @property
     def lowerCAmelCase     (		self    ):
         return not self.alibi




'''simple docstring'''
from __future__ import annotations

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







def  _UpperCamelCase (     _a	:	NDArray[floataa]				,     _a	:	NDArray[floataa]				,     _a	:	list[int]				,     _a	:	int				,     ):




    """simple docstring"""



    __UpperCamelCase    ,					__UpperCamelCase	:	Union[str, Any]		    =  coefficient_matrix.shape
    __UpperCamelCase    ,					__UpperCamelCase	:	Union[str, Any]		    =  constant_matrix.shape

    if rowsa != colsa:
        __UpperCamelCase	:	Tuple		    =  f"""Coefficient matrix dimensions must be nxn but received {rowsa}x{colsa}"""
        raise ValueError(_a			)

    if colsa != 1:
        __UpperCamelCase	:	List[Any]		    =  f"""Constant matrix must be nx1 but received {rowsa}x{colsa}"""
        raise ValueError(_a			)

    if rowsa != rowsa:
        __UpperCamelCase	:	Optional[int]		    =  (
            'Coefficient and constant matrices dimensions must be nxn and nx1 but '
            f"""received {rowsa}x{colsa} and {rowsa}x{colsa}"""
        )
        raise ValueError(_a			)

    if len(_a			) != rowsa:
        __UpperCamelCase	:	Union[str, Any]		    =  (
            'Number of initial values must be equal to number of rows in coefficient '
            f"""matrix but received {len(_a			)} and {rowsa}"""
        )
        raise ValueError(_a			)

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

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

    __UpperCamelCase    ,					__UpperCamelCase	:	Union[str, Any]		    =  table.shape

    strictly_diagonally_dominant(_a			)

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

    return [float(_a			) for i in new_val]







def  _UpperCamelCase (     _a	:	NDArray[floataa]			):




    """simple docstring"""



    __UpperCamelCase    ,					__UpperCamelCase	:	str		    =  table.shape

    __UpperCamelCase	:	str		    =  True

    for i in range(0				,     _a			):
        __UpperCamelCase	:	Optional[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()



