"""simple docstring"""






from collections import deque

from .hash_table import HashTable
class        snake_case (				__UpperCAmelCase       ):




					"""simple docstring"""

					def __init__(       self     :			List[Any]					,*lowerCamelCase__     :			Optional[int]					,**lowerCamelCase__     :			Optional[Any]    ):
									super().__init__(*lowerCamelCase__					,**lowerCamelCase__    )







					def 	__lowerCAmelCase		(       self     :			Optional[int]					,lowerCamelCase__     :			int					,lowerCamelCase__     :			List[Any]    ):
									UpperCAmelCase__    =							deque([]    ) if self.values[key] is None else self.values[key]
									self.values[key].appendleft(lowerCamelCase__    )
									UpperCAmelCase__    =							self.values[key]







					def 	__lowerCAmelCase		(       self     :			Union[str, Any]    ):
									return (
									    sum(self.charge_factor - len(lowerCamelCase__    ) for slot in self.values    )
									    / self.size_table
									    * self.charge_factor
									)







					def 	__lowerCAmelCase		(       self     :			Dict					,lowerCamelCase__     :			Optional[Any]					,lowerCamelCase__     :			Union[str, Any]=None    ):
									if not (
									    len(self.values[key]    ) == self.charge_factor and self.values.count(lowerCamelCase__    ) == 0
									):
													return key
									return super()._collision_resolution(lowerCamelCase__					,lowerCamelCase__    )




"""simple docstring"""






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


lowerCAmelCase__						:						Any		  =			logging.get_logger(__name__)

lowerCAmelCase__						:						str		  =			{'ctrl': 'https://huggingface.co/ctrl/resolve/main/config.json'}
class        snake_case (				__UpperCAmelCase       ):




					"""simple docstring"""

					snake_case__       					=				"ctrl"
					snake_case__       					=				["past_key_values"]
					snake_case__       					=				{
					    "max_position_embeddings": "n_positions",
					    "hidden_size": "n_embd",
					    "num_attention_heads": "n_head",
					    "num_hidden_layers": "n_layer",
					}







					def __init__(       self     :			Any					,lowerCamelCase__     :			str=246_534					,lowerCamelCase__     :			List[str]=256					,lowerCamelCase__     :			Optional[int]=1_280					,lowerCamelCase__     :			Any=8_192					,lowerCamelCase__     :			int=48					,lowerCamelCase__     :			Optional[Any]=16					,lowerCamelCase__     :			Union[str, Any]=0.1					,lowerCamelCase__     :			Dict=0.1					,lowerCamelCase__     :			List[str]=1e-6					,lowerCamelCase__     :			List[str]=0.0_2					,lowerCamelCase__     :			Tuple=True					,**lowerCamelCase__     :			Optional[Any]					,):
									UpperCAmelCase__    =							vocab_size
									UpperCAmelCase__    =							n_positions
									UpperCAmelCase__    =							n_embd
									UpperCAmelCase__    =							n_layer
									UpperCAmelCase__    =							n_head
									UpperCAmelCase__    =							dff
									UpperCAmelCase__    =							resid_pdrop
									UpperCAmelCase__    =							embd_pdrop
									UpperCAmelCase__    =							layer_norm_epsilon
									UpperCAmelCase__    =							initializer_range

									UpperCAmelCase__    =							use_cache

									super().__init__(**lowerCamelCase__    )



