





"""simple docstring"""






from collections.abc import Iterator, MutableMapping
from dataclasses import dataclass
from typing import Generic, TypeVar

A			      =	TypeVar('''KEY''')
A			      =	TypeVar('''VAL''')




@dataclass(frozen=_UpperCamelCase ,   slots=_UpperCamelCase				)
class 					__lowercase      (      Generic[KEY, VAL]				):







					'''simple docstring'''




					__lowerCAmelCase	=	42
					__lowerCAmelCase	=	42






class 					__lowercase      (      _Item				):







					'''simple docstring'''




					def __init__(    self  ):
									super().__init__(_UpperCAmelCase						,      _UpperCAmelCase  )







					def __bool__(    self  ):
									return False






A			      =	_DeletedItem()




class 					__lowercase      (      MutableMapping[KEY, VAL]				):







					'''simple docstring'''




					def __init__(    self						,      _UpperCAmelCase = 8						,      _UpperCAmelCase = 0.7_5  ):
									__a			:    Union[str, Any]      							=	initial_block_size
									__a			:    list[_Item | None]      							=	[None] * initial_block_size
									assert 0.0 < capacity_factor < 1.0
									__a			:    Optional[Any]      							=	capacity_factor
									__a			:    Union[str, Any]      							=	0







					def 			_lowerCamelCase		(    self						,      _UpperCAmelCase  ):
									return hash(_UpperCAmelCase  ) % len(self._buckets  )







					def 			_lowerCamelCase		(    self						,      _UpperCAmelCase  ):
									return (ind + 1) % len(self._buckets  )







					def 			_lowerCamelCase		(    self						,      _UpperCAmelCase						,      _UpperCAmelCase						,      _UpperCAmelCase  ):
									__a			:    List[str]      							=	self._buckets[ind]
									if not stored:
													__a			:    int      							=	_Item(_UpperCAmelCase						,      _UpperCAmelCase  )
													self._len += 1
													return True
									elif stored.key == key:
													__a			:    Dict      							=	_Item(_UpperCAmelCase						,      _UpperCAmelCase  )
													return True
									else:
													return False







					def 			_lowerCamelCase		(    self  ):
									__a			:    Optional[int]      							=	len(self._buckets  ) * self._capacity_factor
									return len(self  ) >= int(_UpperCAmelCase  )







					def 			_lowerCamelCase		(    self  ):
									if len(self._buckets  ) <= self._initial_block_size:
													return False
									__a			:    Optional[Any]      							=	len(self._buckets  ) * self._capacity_factor / 2
									return len(self  ) < limit







					def 			_lowerCamelCase		(    self						,      _UpperCAmelCase  ):
									__a			:    List[str]      							=	self._buckets
									__a			:    List[Any]      							=	[None] * new_size
									__a			:    int      							=	0
									for item in old_buckets:
													if item:
																	self._add_item(item.key						,      item.val  )







					def 			_lowerCamelCase		(    self  ):
									self._resize(len(self._buckets  ) * 2  )







					def 			_lowerCamelCase		(    self  ):
									self._resize(len(self._buckets  ) // 2  )







					def 			_lowerCamelCase		(    self						,      _UpperCAmelCase  ):
									__a			:    int      							=	self._get_bucket_index(_UpperCAmelCase  )
									for _ in range(len(self._buckets  )  ):
													yield ind
													__a			:    Dict      							=	self._get_next_ind(_UpperCAmelCase  )







					def 			_lowerCamelCase		(    self						,      _UpperCAmelCase						,      _UpperCAmelCase  ):
									for ind in self._iterate_buckets(_UpperCAmelCase  ):
													if self._try_set(_UpperCAmelCase						,      _UpperCAmelCase						,      _UpperCAmelCase  ):
																	break







					def __setitem__(    self						,      _UpperCAmelCase						,      _UpperCAmelCase  ):
									if self._is_full():
													self._size_up()

									self._add_item(_UpperCAmelCase						,      _UpperCAmelCase  )







					def __delitem__(    self						,      _UpperCAmelCase  ):
									for ind in self._iterate_buckets(_UpperCAmelCase  ):
													__a			:    List[str]      							=	self._buckets[ind]
													if item is None:
																	raise KeyError(_UpperCAmelCase  )
													if item is _deleted:
																	continue
													if item.key == key:
																	__a			:    Dict      							=	_deleted
																	self._len -= 1
																	break
									if self._is_sparse():
													self._size_down()







					def __getitem__(    self						,      _UpperCAmelCase  ):
									for ind in self._iterate_buckets(_UpperCAmelCase  ):
													__a			:    List[str]      							=	self._buckets[ind]
													if item is None:
																	break
													if item is _deleted:
																	continue
													if item.key == key:
																	return item.val
									raise KeyError(_UpperCAmelCase  )







					def __len__(    self  ):
									return self._len







					def __iter__(    self  ):
									yield from (item.key for item in self._buckets if item)







					def __repr__(    self  ):
									__a			:    List[str]      							=	''' ,'''.join(
									    f"""{item.key}: {item.val}""" for item in self._buckets if item  )
									return f"""HashMap({val_string})"""




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


__snake_case     :List[str]			       =logging.get_logger(__name__)

__snake_case     :int			       ={'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/config.json'}



class        lowerCAmelCase__					(  _lowerCamelCase       ):
				A_   :     Optional[Any]								=     'openai-gpt'
				A_   :     Any								=     {
				    'max_position_embeddings': 'n_positions',
				    'hidden_size': 'n_embd',
				    'num_attention_heads': 'n_head',
				    'num_hidden_layers': 'n_layer',
				}


				def __init__(							self      :  List[Any]						, __UpperCamelCase      :  List[str]=40_478						, __UpperCamelCase      :  List[Any]=512						, __UpperCamelCase      :  List[Any]=768						, __UpperCamelCase      :  Optional[int]=12						, __UpperCamelCase      :  Dict=12						, __UpperCamelCase      :  List[str]="gelu"						, __UpperCamelCase      :  str=0.1						, __UpperCamelCase      :  Optional[Any]=0.1						, __UpperCamelCase      :  Union[str, Any]=0.1						, __UpperCamelCase      :  List[str]=1e-5						, __UpperCamelCase      :  List[Any]=0.0_2						, __UpperCamelCase      :  str="cls_index"						, __UpperCamelCase      :  int=True						, __UpperCamelCase      :  int=None						, __UpperCamelCase      :  Optional[int]=True						, __UpperCamelCase      :  Tuple=0.1						, **__UpperCamelCase      :  List[Any]						, )		->     List[str]:
											A      						=    vocab_size
											A      						=    n_positions
											A      						=    n_embd
											A      						=    n_layer
											A      						=    n_head
											A      						=    afn
											A      						=    resid_pdrop
											A      						=    embd_pdrop
											A      						=    attn_pdrop
											A      						=    layer_norm_epsilon
											A      						=    initializer_range
											A      						=    summary_type
											A      						=    summary_use_proj
											A      						=    summary_activation
											A      						=    summary_first_dropout
											A      						=    summary_proj_to_labels
											super().__init__(**__UpperCamelCase       )