




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

a_				:    Union[str, Any]							=     TypeVar('''KEY''')
a_				:    Any							=     TypeVar('''VAL''')

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




					'''simple docstring'''


					__a						:						KEY
					__a						:						VAL



class __lowercase(      _Item				):




					'''simple docstring'''


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





					def __bool__(    self     ):
								return False



a_				:    Tuple							=     _DeletedItem()

class __lowercase(      MutableMapping[KEY, VAL]				):




					'''simple docstring'''


					def __init__(    self						,	__a = 8						,	__a = 0.75     ):
								__lowerCamelCase					:	Optional[Any]	       =				initial_block_size
								__lowerCamelCase					:	list[_Item | None]	       =				[None] * initial_block_size
								assert 0.0 < capacity_factor < 1.0
								__lowerCamelCase					:	str	       =				capacity_factor
								__lowerCamelCase					:	Tuple	       =				0
					def     snake_case_				(    self						,	__a     ):
								return hash(__a     ) % len(self._buckets     )
					def     snake_case_				(    self						,	__a     ):
								return (ind + 1) % len(self._buckets     )
					def     snake_case_				(    self						,	__a						,	__a						,	__a     ):
								__lowerCamelCase					:	List[str]	       =				self._buckets[ind]
								if not stored:
											__lowerCamelCase					:	Optional[Any]	       =				_Item(__a						,	__a     )
											self._len += 1
											return True
								elif stored.key == key:
											__lowerCamelCase					:	Any	       =				_Item(__a						,	__a     )
											return True
								else:
											return False
					def     snake_case_				(    self     ):
								__lowerCamelCase					:	Optional[int]	       =				len(self._buckets     ) * self._capacity_factor
								return len(self     ) >= int(__a     )
					def     snake_case_				(    self     ):
								if len(self._buckets     ) <= self._initial_block_size:
											return False
								__lowerCamelCase					:	str	       =				len(self._buckets     ) * self._capacity_factor / 2
								return len(self     ) < limit
					def     snake_case_				(    self						,	__a     ):
								__lowerCamelCase					:	Optional[int]	       =				self._buckets
								__lowerCamelCase					:	Union[str, Any]	       =				[None] * new_size
								__lowerCamelCase					:	List[str]	       =				0
								for item in old_buckets:
											if item:
														self._add_item(item.key						,	item.val     )
					def     snake_case_				(    self     ):
								self._resize(len(self._buckets     ) * 2     )
					def     snake_case_				(    self     ):
								self._resize(len(self._buckets     ) // 2     )
					def     snake_case_				(    self						,	__a     ):
								__lowerCamelCase					:	Optional[Any]	       =				self._get_bucket_index(__a     )
								for _ in range(len(self._buckets     )     ):
											yield ind
											__lowerCamelCase					:	int	       =				self._get_next_ind(__a     )
					def     snake_case_				(    self						,	__a						,	__a     ):
								for ind in self._iterate_buckets(__a     ):
											if self._try_set(__a						,	__a						,	__a     ):
														break
					def __setitem__(    self						,	__a						,	__a     ):
								if self._is_full():
											self._size_up()

								self._add_item(__a						,	__a     )
					def __delitem__(    self						,	__a     ):
								for ind in self._iterate_buckets(__a     ):
											__lowerCamelCase					:	List[Any]	       =				self._buckets[ind]
											if item is None:
														raise KeyError(__a     )
											if item is _deleted:
														continue
											if item.key == key:
														__lowerCamelCase					:	List[str]	       =				_deleted
														self._len -= 1
														break
								if self._is_sparse():
											self._size_down()
					def __getitem__(    self						,	__a     ):
								for ind in self._iterate_buckets(__a     ):
											__lowerCamelCase					:	Any	       =				self._buckets[ind]
											if item is None:
														break
											if item is _deleted:
														continue
											if item.key == key:
														return item.val
								raise KeyError(__a     )
					def __len__(    self     ):
								return self._len
					def __iter__(    self     ):
								yield from (item.key for item in self._buckets if item)





					def __repr__(    self     ):
								__lowerCamelCase					:	Optional[Any]	       =				' ,'.join(
								    f'''{item.key}: {item.val}''' for item in self._buckets if item     )
								return f'''HashMap({val_string})'''









"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


a_				:    Tuple										=     logging.get_logger(__name__)

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

class __lowercase(      lowercase__				):




					'''simple docstring'''


					__a						:						Union[str, Any]     		= 'openai-gpt'
					__a						:						List[Any]     		= {
					    'max_position_embeddings': 'n_positions',
					    'hidden_size': 'n_embd',
					    'num_attention_heads': 'n_head',
					    'num_hidden_layers': 'n_layer',
					}
					def __init__(    self						,	__a=40478						,	__a=512						,	__a=768						,	__a=12						,	__a=12						,	__a="gelu"						,	__a=0.1						,	__a=0.1						,	__a=0.1						,	__a=1E-5						,	__a=0.02						,	__a="cls_index"						,	__a=True						,	__a=None						,	__a=True						,	__a=0.1						,	**__a						,	):
								__lowerCamelCase					:	List[str]	       =				vocab_size
								__lowerCamelCase					:	Union[str, Any]	       =				n_positions
								__lowerCamelCase					:	Optional[Any]	       =				n_embd
								__lowerCamelCase					:	int	       =				n_layer
								__lowerCamelCase					:	List[str]	       =				n_head
								__lowerCamelCase					:	Dict	       =				afn
								__lowerCamelCase					:	Optional[Any]	       =				resid_pdrop
								__lowerCamelCase					:	int	       =				embd_pdrop
								__lowerCamelCase					:	int	       =				attn_pdrop
								__lowerCamelCase					:	Dict	       =				layer_norm_epsilon
								__lowerCamelCase					:	List[str]	       =				initializer_range
								__lowerCamelCase					:	Any	       =				summary_type
								__lowerCamelCase					:	Tuple	       =				summary_use_proj
								__lowerCamelCase					:	List[Any]	       =				summary_activation
								__lowerCamelCase					:	str	       =				summary_first_dropout
								__lowerCamelCase					:	Tuple	       =				summary_proj_to_labels
								super().__init__(**__a     )



