

"""simple docstring"""




from collections import deque

from .hash_table import HashTable







class   __lowercase      (     __lowerCamelCase       ):

  def __init__(	self		:      List[str]       ,*A		:      Optional[Any]       ,**A		:      Optional[int]     ):






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

  def  __lowercase							(	self		:      int       ,A		:      List[Any]       ,A		:      Tuple     ):






   '''simple docstring'''
   UpperCAmelCase__       :	List[Any]        =       deque([]     ) if self.values[key] is None else self.values[key]
   self.values[key].appendleft(A     )
   UpperCAmelCase__       :	Union[str, Any]        =       self.values[key]

  def  __lowercase							(	self		:      str     ):






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




  def  __lowercase							(	self		:      Union[str, Any]       ,A		:      int       ,A		:      str=None     ):






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













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


_UpperCamelCase			:	List[Any]								=logging.get_logger(__name__)

_UpperCamelCase			:	Optional[Any]								={
    'google/pegasus-large': 'https://huggingface.co/google/pegasus-large/resolve/main/config.json',
    # See all PEGASUS models at https://huggingface.co/models?filter=pegasus
}






class 						UpperCAmelCase__ (							__snake_case							):
		__snake_case      :       Optional[int]     =   "pegasus"
		__snake_case      :       List[str]     =   ["past_key_values"]
		__snake_case      :       Union[str, Any]     =   {"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}







		def __init__(					self       ,A__=50265       ,A__=1024       ,A__=12       ,A__=4096       ,A__=16       ,A__=12       ,A__=4096       ,A__=16       ,A__=0.0       ,A__=0.0       ,A__=True       ,A__=True       ,A__="gelu"       ,A__=1024       ,A__=0.1       ,A__=0.0       ,A__=0.0       ,A__=0.02       ,A__=0       ,A__=False       ,A__=0       ,A__=1       ,A__=1       ,**A__       ,):
						_A	:				List[str]   =      vocab_size
						_A	:				List[Any]   =      max_position_embeddings
						_A	:				Union[str, Any]   =      d_model
						_A	:				Union[str, Any]   =      encoder_ffn_dim
						_A	:				Union[str, Any]   =      encoder_layers
						_A	:				int   =      encoder_attention_heads
						_A	:				List[Any]   =      decoder_ffn_dim
						_A	:				Optional[int]   =      decoder_layers
						_A	:				Tuple   =      decoder_attention_heads
						_A	:				List[str]   =      dropout
						_A	:				Tuple   =      attention_dropout
						_A	:				Union[str, Any]   =      activation_dropout
						_A	:				int   =      activation_function
						_A	:				Union[str, Any]   =      init_std
						_A	:				Any   =      encoder_layerdrop
						_A	:				int   =      decoder_layerdrop
						_A	:				Tuple   =      use_cache
						_A	:				Dict   =      encoder_layers
						_A	:				List[str]   =      scale_embedding  # scale factor will be sqrt(d_model) if True
						super().__init__(
						    pad_token_id=A__       ,eos_token_id=A__       ,is_encoder_decoder=A__       ,decoder_start_token_id=A__       ,forced_eos_token_id=A__       ,**A__       ,)







		@property
		def  A__      (					self		):
						return self.encoder_attention_heads







		@property
		def  A__      (					self		):
						return self.d_model



