

"""simple docstring"""




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


_lowercase   :	Any												=						logging.get_logger(__name__)

_lowercase   :	Union[str, Any]												=						{'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/config.json'}
class      _UpperCAmelCase   (							_UpperCamelCase       ):
	a__		: str					=					'openai-gpt'
	a__		: Tuple					=					{
	    'max_position_embeddings': 'n_positions',
	    'hidden_size': 'n_embd',
	    'num_attention_heads': 'n_head',
	    'num_hidden_layers': 'n_layer',
	}



	def __init__(  self     :       Optional[int]			,    _lowercase     :       Any=4_04_78			,    _lowercase     :       Dict=5_12			,    _lowercase     :       Union[str, Any]=7_68			,    _lowercase     :       List[str]=12			,    _lowercase     :       Dict=12			,    _lowercase     :       Union[str, Any]="gelu"			,    _lowercase     :       Union[str, Any]=0.1			,    _lowercase     :       str=0.1			,    _lowercase     :       Any=0.1			,    _lowercase     :       Optional[int]=1E-5			,    _lowercase     :       str=0.02			,    _lowercase     :       List[Any]="cls_index"			,    _lowercase     :       List[str]=True			,    _lowercase     :       Union[str, Any]=None			,    _lowercase     :       Optional[int]=True			,    _lowercase     :       str=0.1			,    **_lowercase     :       Optional[Any]			,    ):
		__UpperCAmelCase      		= vocab_size
		__UpperCAmelCase      		= n_positions
		__UpperCAmelCase      		= n_embd
		__UpperCAmelCase      		= n_layer
		__UpperCAmelCase      		= n_head
		__UpperCAmelCase      		= afn
		__UpperCAmelCase      		= resid_pdrop
		__UpperCAmelCase      		= embd_pdrop
		__UpperCAmelCase      		= attn_pdrop
		__UpperCAmelCase      		= layer_norm_epsilon
		__UpperCAmelCase      		= initializer_range
		__UpperCAmelCase      		= summary_type
		__UpperCAmelCase      		= summary_use_proj
		__UpperCAmelCase      		= summary_activation
		__UpperCAmelCase      		= summary_first_dropout
		__UpperCAmelCase      		= summary_proj_to_labels
		super().__init__(**_UpperCAmelCase						)





'''simple docstring'''

# Author: OMKAR PATHAK, Nwachukwu Chidiebere

# Use a Python dictionary to construct the graph.
from __future__ import annotations

from pprint import pformat
from typing import Generic, TypeVar

__lowerCAmelCase		     =  TypeVar('''T''')

class       __magic_name__		(       Generic[T]  ):







							def __init__(				self   :			int      ,_UpperCAmelCase   :			bool = True						):
									_a	: dict[T, list[T]]								=				{}  # dictionary of lists
									_a	: Tuple								=				directed







							def 				__lowercase     (				self   :			Union[str, Any]      ,_UpperCAmelCase   :			T      ,_UpperCAmelCase   :			T						):

									if not self.directed:  # For undirected graphs
											# if both source vertex and destination vertex are both present in the
											# adjacency list, add destination vertex to source vertex list of adjacent
											# vertices and add source vertex to destination vertex list of adjacent
											# vertices.
											if source_vertex in self.adj_list and destination_vertex in self.adj_list:
													self.adj_list[source_vertex].append(_UpperCAmelCase						)
													self.adj_list[destination_vertex].append(_UpperCAmelCase						)
											# if only source vertex is present in adjacency list, add destination vertex
											# to source vertex list of adjacent vertices, then create a new vertex with
											# destination vertex as key and assign a list containing the source vertex
											# as it's first adjacent vertex.
											elif source_vertex in self.adj_list:
													self.adj_list[source_vertex].append(_UpperCAmelCase						)
													_a	: Optional[Any]								=				[source_vertex]
											# if only destination vertex is present in adjacency list, add source vertex
											# to destination vertex list of adjacent vertices, then create a new vertex
											# with source vertex as key and assign a list containing the source vertex
											# as it's first adjacent vertex.
											elif destination_vertex in self.adj_list:
													self.adj_list[destination_vertex].append(_UpperCAmelCase						)
													_a	: Union[str, Any]								=				[destination_vertex]
											# if both source vertex and destination vertex are not present in adjacency
											# list, create a new vertex with source vertex as key and assign a list
											# containing the destination vertex as it's first adjacent vertex also
											# create a new vertex with destination vertex as key and assign a list
											# containing the source vertex as it's first adjacent vertex.
											else:
													_a	: Union[str, Any]								=				[destination_vertex]
													_a	: Optional[int]								=				[source_vertex]
									else:  # For directed graphs
											# if both source vertex and destination vertex are present in adjacency
											# list, add destination vertex to source vertex list of adjacent vertices.
											if source_vertex in self.adj_list and destination_vertex in self.adj_list:
													self.adj_list[source_vertex].append(_UpperCAmelCase						)
											# if only source vertex is present in adjacency list, add destination
											# vertex to source vertex list of adjacent vertices and create a new vertex
											# with destination vertex as key, which has no adjacent vertex
											elif source_vertex in self.adj_list:
													self.adj_list[source_vertex].append(_UpperCAmelCase						)
													_a	: int								=				[]
											# if only destination vertex is present in adjacency list, create a new
											# vertex with source vertex as key and assign a list containing destination
											# vertex as first adjacent vertex
											elif destination_vertex in self.adj_list:
													_a	: Tuple								=				[destination_vertex]
											# if both source vertex and destination vertex are not present in adjacency
											# list, create a new vertex with source vertex as key and a list containing
											# destination vertex as it's first adjacent vertex. Then create a new vertex
											# with destination vertex as key, which has no adjacent vertex
											else:
													_a	: Tuple								=				[destination_vertex]
													_a	: str								=				[]

									return self







							def __repr__(				self   :			int						):
									return pformat(self.adj_list						)




