


from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass






@dataclass
class _lowerCamelCase:
       lowercase_					:      int
       lowercase_					:      int






class _lowerCamelCase:
       def __init__(   self, lowerCamelCase)			->  Optional[Any]:




           """simple docstring"""

           _lowercase			:				list[list[Edge]] 						=						[[] for _ in range(__snake_case)]
           _lowercase			:				Any 						=						size
       def __getitem__(   self, lowerCamelCase)			->  List[Any]:




           """simple docstring"""

           return iter(self._graph[vertex])
       @property
       def      UpperCamelCase	(   self)			->  Optional[int]:




           """simple docstring"""

           return self._size
       def      UpperCamelCase	(   self, lowerCamelCase, lowerCamelCase, lowerCamelCase)			->  List[Any]:




           """simple docstring"""

           if weight not in (0, 1):
               raise ValueError('Edge weight must be either 0 or 1.')

           if to_vertex < 0 or to_vertex >= self.size:
               raise ValueError('Vertex indexes must be in [0; size).')

           self._graph[from_vertex].append(Edge(__snake_case, __snake_case))




       def      UpperCamelCase	(   self, lowerCamelCase, lowerCamelCase)			->  Tuple:




           """simple docstring"""

           _lowercase			:				Tuple 						=						deque([start_vertex])
           _lowercase			:				list[int | None] 						=						[None] * self.size
           _lowercase			:				Union[str, Any] 						=						0

           while queue:
               _lowercase			:				Optional[int] 						=						queue.popleft()
               _lowercase			:				Union[str, Any] 						=						distances[current_vertex]
               if current_distance is None:
                   continue

               for edge in self[current_vertex]:
                   _lowercase			:				List[Any] 						=						current_distance + edge.weight
                   _lowercase			:				Union[str, Any] 						=						distances[edge.destination_vertex]
                   if (
                       isinstance(__snake_case, __snake_case)
                       and new_distance >= dest_vertex_distance
                   ):
                       continue
                   _lowercase			:				str 						=						new_distance
                   if edge.weight == 0:
                       queue.appendleft(edge.destination_vertex)
                   else:
                       queue.append(edge.destination_vertex)

           if distances[finish_vertex] is None:
               raise ValueError('No path from start_vertex to finish_vertex.')

           return distances[finish_vertex]


if __name__ == "__main__":
 import doctest

 doctest.testmod()






'''simple docstring'''


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


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

UpperCAmelCase_						:  Any				  =						{
    'bigcode/gpt_bigcode-santacoder': 'https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json',
}





class        lowercase__    (		_snake_case   ):





							'''simple docstring'''


							A_				: Dict       =    """gpt_bigcode"""
							A_				: str       =    ["""past_key_values"""]
							A_				: Tuple       =    {
							    """hidden_size""": """n_embd""",
							    """max_position_embeddings""": """n_positions""",
							    """num_attention_heads""": """n_head""",
							    """num_hidden_layers""": """n_layer""",
							}






							def __init__(       self       ,   __snake_case=5_0257       ,   __snake_case=1024       ,   __snake_case=768       ,   __snake_case=12       ,   __snake_case=12       ,   __snake_case=None       ,   __snake_case="gelu_pytorch_tanh"       ,   __snake_case=0.1       ,   __snake_case=0.1       ,   __snake_case=0.1       ,   __snake_case=1e-5       ,   __snake_case=0.02       ,   __snake_case=True       ,   __snake_case=True       ,   __snake_case=5_0256       ,   __snake_case=5_0256       ,   __snake_case=True       ,   __snake_case=True       ,   __snake_case=True       ,   **__snake_case       ,   ):
											_SCREAMING_SNAKE_CASE					:			Optional[Any]							= vocab_size
											_SCREAMING_SNAKE_CASE					:			Optional[Any]							= n_positions
											_SCREAMING_SNAKE_CASE					:			List[Any]							= n_embd
											_SCREAMING_SNAKE_CASE					:			Union[str, Any]							= n_layer
											_SCREAMING_SNAKE_CASE					:			Union[str, Any]							= n_head
											_SCREAMING_SNAKE_CASE					:			Optional[int]							= n_inner
											_SCREAMING_SNAKE_CASE					:			Optional[Any]							= activation_function
											_SCREAMING_SNAKE_CASE					:			Union[str, Any]							= resid_pdrop
											_SCREAMING_SNAKE_CASE					:			Union[str, Any]							= embd_pdrop
											_SCREAMING_SNAKE_CASE					:			List[Any]							= attn_pdrop
											_SCREAMING_SNAKE_CASE					:			Optional[int]							= layer_norm_epsilon
											_SCREAMING_SNAKE_CASE					:			Any							= initializer_range
											_SCREAMING_SNAKE_CASE					:			str							= scale_attn_weights
											_SCREAMING_SNAKE_CASE					:			Tuple							= use_cache
											_SCREAMING_SNAKE_CASE					:			Optional[int]							= attention_softmax_in_fpaa
											_SCREAMING_SNAKE_CASE					:			List[Any]							= scale_attention_softmax_in_fpaa
											_SCREAMING_SNAKE_CASE					:			Any							= multi_query

											_SCREAMING_SNAKE_CASE					:			Optional[int]							= bos_token_id
											_SCREAMING_SNAKE_CASE					:			Optional[int]							= eos_token_id

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




