



'''simple docstring'''

def 	__lowerCamelCase	( lowerCAmelCase_    )     -> None:
		_a	: Dict								=				generate_pascal_triangle(lowerCAmelCase_    )
		for row_idx in range(lowerCAmelCase_    ):
				# Print left spaces
				for _ in range(num_rows - row_idx - 1    ):
						print(end=' '    )
				# Print row values
				for col_idx in range(row_idx + 1    ):
						if col_idx != row_idx:
								print(triangle[row_idx][col_idx]		,     end=' '    )
						else:
								print(triangle[row_idx][col_idx]		,     end=''    )
				print()



def 	__lowerCamelCase	( lowerCAmelCase_    )     -> list[list[int]]:

		if not isinstance(lowerCAmelCase_		,     lowerCAmelCase_    ):
				raise TypeError('The input value of \'num_rows\' should be \'int\''    )

		if num_rows == 0:
				return []
		elif num_rows < 0:
				raise ValueError(
				    'The input value of \'num_rows\' should be greater than or equal to 0'    )

		_a	: list[list[int]]								=				[]
		for current_row_idx in range(lowerCAmelCase_    ):
				_a	: List[Any]								=				populate_current_row(lowerCAmelCase_		,     lowerCAmelCase_    )
				triangle.append(lowerCAmelCase_    )
		return triangle



def 	__lowerCamelCase	( lowerCAmelCase_		,     lowerCAmelCase_    )     -> list[int]:
		_a	: List[Any]								=				[-1] * (current_row_idx + 1)
		# first and last elements of current row are equal to 1
		_a			,   _a	: Union[str, Any]								=				1, 1
		for current_col_idx in range(1		,     lowerCAmelCase_    ):
				calculate_current_element(
				    lowerCAmelCase_		,     lowerCAmelCase_		,     lowerCAmelCase_		,     lowerCAmelCase_    )
		return current_row



def 	__lowerCamelCase	( lowerCAmelCase_		,     lowerCAmelCase_		,     lowerCAmelCase_		,     lowerCAmelCase_		,     )     -> None:
		_a	: str								=				triangle[current_row_idx - 1][current_col_idx - 1]
		_a	: Optional[Any]								=				triangle[current_row_idx - 1][current_col_idx]
		_a	: int								=				above_to_left_elt + above_to_right_elt



def 	__lowerCamelCase	( lowerCAmelCase_    )     -> list[list[int]]:

		if not isinstance(lowerCAmelCase_		,     lowerCAmelCase_    ):
				raise TypeError('The input value of \'num_rows\' should be \'int\''    )

		if num_rows == 0:
				return []
		elif num_rows < 0:
				raise ValueError(
				    'The input value of \'num_rows\' should be greater than or equal to 0'    )

		_a	: list[list[int]]								=				[[1]]

		for row_index in range(1		,     lowerCAmelCase_    ):
				_a	: Any								=				[0] + result[-1] + [0]
				_a	: Any								=				row_index + 1
				# Calculate the number of distinct elements in a row
				_a	: Optional[Any]								=				sum(divmod(lowerCAmelCase_		,     2    )    )
				_a	: Dict								=				[
				    temp_row[i - 1] + temp_row[i] for i in range(1		,     distinct_elements + 1    )
				]
				_a	: Dict								=				row_first_half[: (row_index + 1) // 2]
				row_second_half.reverse()
				_a	: Dict								=				row_first_half + row_second_half
				result.append(lowerCAmelCase_    )

		return result



def 	__lowerCamelCase	( )     -> None:
		from collections.abc import Callable
		from timeit import timeit

		def benchmark_a_function(lowerCAmelCase_		,     lowerCAmelCase_    ) -> None:
				_a	: Tuple								=				f"""{func.__name__}({value})"""
				_a	: Optional[int]								=				timeit(f"""__main__.{call}"""		,     setup='import __main__'    )
				# print(f"{call:38} = {func(value)} -- {timing:.4f} seconds")
				print(f"""{call:38} -- {timing:.4f} seconds"""    )

		for value in range(15    ):  # (1, 7, 14):
				for func in (generate_pascal_triangle, generate_pascal_triangle_optimized):
						benchmark_a_function(lowerCAmelCase_		,     lowerCAmelCase_    )
				print()


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							benchmark()









'''simple docstring'''

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


__lowerCAmelCase		     =  logging.get_logger(__name__)

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

class       __magic_name__		(       _UpperCamelCase  ):
							lowerCAmelCase			:       str  							=   'open-llama'







							def __init__(				self   :			str      ,_UpperCAmelCase   :			int=100000      ,_UpperCAmelCase   :			List[str]=4096      ,_UpperCAmelCase   :			Dict=11008      ,_UpperCAmelCase   :			int=32      ,_UpperCAmelCase   :			Union[str, Any]=32      ,_UpperCAmelCase   :			List[str]="silu"      ,_UpperCAmelCase   :			List[Any]=2048      ,_UpperCAmelCase   :			Any=0.02      ,_UpperCAmelCase   :			int=1E-6      ,_UpperCAmelCase   :			Optional[int]=True      ,_UpperCAmelCase   :			Dict=0      ,_UpperCAmelCase   :			Optional[Any]=1      ,_UpperCAmelCase   :			Dict=2      ,_UpperCAmelCase   :			Tuple=False      ,_UpperCAmelCase   :			Dict=True      ,_UpperCAmelCase   :			Dict=0.1      ,_UpperCAmelCase   :			Optional[int]=0.1      ,_UpperCAmelCase   :			List[str]=True      ,_UpperCAmelCase   :			int=True      ,_UpperCAmelCase   :			Union[str, Any]=None      ,**_UpperCAmelCase   :			Optional[int]      ,):
									_a	: str								=				vocab_size
									_a	: str								=				max_position_embeddings
									_a	: List[str]								=				hidden_size
									_a	: Any								=				intermediate_size
									_a	: Union[str, Any]								=				num_hidden_layers
									_a	: Tuple								=				num_attention_heads
									_a	: int								=				hidden_act
									_a	: str								=				initializer_range
									_a	: Any								=				rms_norm_eps
									_a	: Dict								=				use_cache
									_a	: Optional[int]								=				kwargs.pop(
									    'use_memorry_efficient_attention'      ,_UpperCAmelCase						)
									_a	: int								=				hidden_dropout_prob
									_a	: int								=				attention_dropout_prob
									_a	: Union[str, Any]								=				use_stable_embedding
									_a	: str								=				shared_input_output_embedding
									_a	: 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 				__lowercase     (				self   :			Optional[Any]						):
									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}"""						)
									_a	: Optional[Any]								=				self.rope_scaling.get('type'      ,_UpperCAmelCase						)
									_a	: Optional[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}"""						)




