

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


UpperCAmelCase_							:					Optional[Any]		 =   logging.get_logger(__name__)

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






class      lowerCamelCase_      (	_lowercase	):
	_lowercase		:   List[Any]     					=				'''open-llama'''




	def __init__(     self						:     Union[str, Any]					,      __A						:     Dict=10_0000					,      __A						:     Optional[int]=4096					,      __A						:     str=1_1008					,      __A						:     str=32					,      __A						:     Union[str, Any]=32					,      __A						:     str="silu"					,      __A						:     Tuple=2048					,      __A						:     Optional[Any]=0.0_2					,      __A						:     List[Any]=1e-6					,      __A						:     Dict=True					,      __A						:     Optional[Any]=0					,      __A						:     str=1					,      __A						:     Any=2					,      __A						:     Optional[int]=False					,      __A						:     List[Any]=True					,      __A						:     Any=0.1					,      __A						:     int=0.1					,      __A						:     Optional[int]=True					,      __A						:     Optional[int]=True					,      __A						:     Optional[Any]=None					,      **__A						:     str					,      ):
		__A :			List[str]		    =			vocab_size
		__A :			Dict		    =			max_position_embeddings
		__A :			Dict		    =			hidden_size
		__A :			str		    =			intermediate_size
		__A :			Tuple		    =			num_hidden_layers
		__A :			Optional[Any]		    =			num_attention_heads
		__A :			Optional[int]		    =			hidden_act
		__A :			List[Any]		    =			initializer_range
		__A :			Tuple		    =			rms_norm_eps
		__A :			str		    =			use_cache
		__A :			Optional[int]		    =			kwargs.pop(
		    """use_memorry_efficient_attention"""					,      __A							)
		__A :			Union[str, Any]		    =			hidden_dropout_prob
		__A :			Optional[Any]		    =			attention_dropout_prob
		__A :			str		    =			use_stable_embedding
		__A :			Dict		    =			shared_input_output_embedding
		__A :			List[str]		    =			rope_scaling
		self._rope_scaling_validation()

		super().__init__(
		    pad_token_id=__A					,      bos_token_id=__A					,      eos_token_id=__A					,      tie_word_embeddings=__A					,      **__A					,      )




	def        lowerCAmelCase_       (     self						:     List[Any]							):
		if self.rope_scaling is None:
			return

		if not isinstance(self.rope_scaling					,      __A							) 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 :			Dict		    =			self.rope_scaling.get("""type"""					,      __A							)
		__A :			Optional[Any]		    =			self.rope_scaling.get("""factor"""					,      __A							)
		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(__A					,      __A							) or rope_scaling_factor <= 1.0:
			raise ValueError(F"""`rope_scaling`'s factor field must be an float > 1, got {rope_scaling_factor}"""							)








import math






class      lowerCamelCase_      :




	def __init__(     self						:     Union[str, Any]					,      __A						:     List[str]=0							):  # a graph with Node 0,1,...,N-1
		__A :			List[str]		    =			n
		__A :			List[str]		    =			[
		    [math.inf for j in range(0					,      __A							)] for i in range(0					,      __A							)
		]  # adjacency matrix for weight
		__A :			str		    =			[
		    [math.inf for j in range(0					,      __A							)] for i in range(0					,      __A							)
		]  # dp[i][j] stores minimum distance from i to j




	def        lowerCAmelCase_       (     self						:     str					,      __A						:     Union[str, Any]					,      __A						:     Any					,      __A						:     Optional[int]							):
		__A :			List[Any]		    =			w




	def        lowerCAmelCase_       (     self						:     Union[str, Any]							):
		for k in range(0					,      self.n							):
			for i in range(0					,      self.n							):
				for j in range(0					,      self.n							):
					__A :			List[Any]		    =			min(self.dp[i][j]					,      self.dp[i][k] + self.dp[k][j]							)




	def        lowerCAmelCase_       (     self						:     int					,      __A						:     List[str]					,      __A						:     List[str]							):
		return self.dp[u][v]


if __name__ == "__main__":
			UpperCAmelCase_							:					Tuple		 =   Graph(5)
			graph.add_edge(0, 2, 9)
			graph.add_edge(0, 4, 10)
			graph.add_edge(1, 3, 5)
			graph.add_edge(2, 3, 7)
			graph.add_edge(3, 0, 10)
			graph.add_edge(3, 1, 2)
			graph.add_edge(3, 2, 1)
			graph.add_edge(3, 4, 6)
			graph.add_edge(4, 1, 3)
			graph.add_edge(4, 2, 4)
			graph.add_edge(4, 3, 9)
			graph.floyd_warshall()
			graph.show_min(1, 4)
			graph.show_min(0, 3)





