

from collections import deque

from .hash_table import HashTable






class       __magic_name__       (     _lowerCamelCase ):





			def __init__(						self   ,    *__snake_case   ,    **__snake_case   )  ->					List[Any]:




						'''simple docstring'''
						super().__init__(*__UpperCamelCase   ,    **__UpperCamelCase   )





			def 						__magic_name__       (						self   ,    __snake_case   ,    __snake_case   )  ->					str:




						'''simple docstring'''
						__a     =deque([]   ) if self.values[key] is None else self.values[key]
						self.values[key].appendleft(__UpperCamelCase   )
						__a     =self.values[key]





			def 						__magic_name__       (						self   )  ->					Tuple:




						'''simple docstring'''
						return (
						    sum(self.charge_factor - len(__UpperCamelCase   ) for slot in self.values   )
						    / self.size_table
						    * self.charge_factor
						)





			def 						__magic_name__       (						self   ,    __snake_case   ,    __snake_case=None   )  ->					str:




						'''simple docstring'''
						if not (
						    len(self.values[key]   ) == self.charge_factor and self.values.count(__UpperCamelCase   ) == 0
						):
									return key
						return super()._collision_resolution(__UpperCamelCase   ,    __UpperCamelCase   )











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       )