


from collections.abc import Callable





class  lowerCAmelCase__:






    '''simple docstring'''





    def __init__(	self				:   Tuple       ,   __snake_case				:   Callable | None = None	):





       '''simple docstring'''
       # Stores actual heap items.
       UpperCAmelCase_							:      list						=   []
       # Stores indexes of each item for supporting updates and deletion.
       UpperCAmelCase_							:      dict						=   {}
       # Stores current size of heap.
       UpperCAmelCase_							:      Optional[int]						=   0
       # Stores function used to evaluate the score of an item on which basis ordering
       # will be done.
       UpperCAmelCase_							:      List[str]						=   key or (lambda __snake_case	: x)





    def 					_lowerCamelCase (	self				:   List[Any]       ,   __snake_case				:   int	):





       '''simple docstring'''
       return int((i - 1) / 2	) if i > 0 else None





    def 					_lowerCamelCase (	self				:   List[str]       ,   __snake_case				:   int	):





       '''simple docstring'''
       UpperCAmelCase_							:      Any						=   int(2 * i + 1	)
       return left if 0 < left < self.size else None





    def 					_lowerCamelCase (	self				:   int       ,   __snake_case				:   int	):





       '''simple docstring'''
       UpperCAmelCase_							:      Dict						=   int(2 * i + 2	)
       return right if 0 < right < self.size else None





    def 					_lowerCamelCase (	self				:   List[Any]       ,   __snake_case				:   int       ,   __snake_case				:   int	):





       '''simple docstring'''
       UpperCAmelCase_		,      UpperCAmelCase_							:      Optional[Any]						=   (
           self.pos_map[self.arr[j][0]],
           self.pos_map[self.arr[i][0]],
       )
       # Then swap the items in the list.
       UpperCAmelCase_		,      UpperCAmelCase_							:      Tuple						=   self.arr[j], self.arr[i]





    def 					_lowerCamelCase (	self				:   int       ,   __snake_case				:   int       ,   __snake_case				:   int	):





       '''simple docstring'''
       return self.arr[i][1] < self.arr[j][1]





    def 					_lowerCamelCase (	self				:   Any       ,   __snake_case				:   int	):





       '''simple docstring'''
       UpperCAmelCase_							:      List[Any]						=   self._left(__snake_case	)
       UpperCAmelCase_							:      Optional[int]						=   self._right(__snake_case	)
       UpperCAmelCase_							:      Any						=   i

       if left is not None and not self._cmp(__snake_case       ,   __snake_case	):
          UpperCAmelCase_							:      Tuple						=   left
       if right is not None and not self._cmp(__snake_case       ,   __snake_case	):
          UpperCAmelCase_							:      Optional[int]						=   right

       return valid_parent





    def 					_lowerCamelCase (	self				:   Any       ,   __snake_case				:   int	):





       '''simple docstring'''
       UpperCAmelCase_							:      Any						=   self._parent(__snake_case	)
       while parent is not None and not self._cmp(__snake_case       ,   __snake_case	):
          self._swap(__snake_case       ,   __snake_case	)
          UpperCAmelCase_		,      UpperCAmelCase_							:      int						=   parent, self._parent(__snake_case	)





    def 					_lowerCamelCase (	self				:   int       ,   __snake_case				:   int	):





       '''simple docstring'''
       UpperCAmelCase_							:      Tuple						=   self._get_valid_parent(__snake_case	)
       while valid_parent != index:
          self._swap(__snake_case       ,   __snake_case	)
          UpperCAmelCase_		,      UpperCAmelCase_							:      List[Any]						=   valid_parent, self._get_valid_parent(__snake_case	)





    def 					_lowerCamelCase (	self				:   str       ,   __snake_case				:   int       ,   __snake_case				:   int	):





       '''simple docstring'''
       if item not in self.pos_map:
          return
       UpperCAmelCase_							:      List[Any]						=   self.pos_map[item]
       UpperCAmelCase_							:      Optional[Any]						=   [item, self.key(__snake_case	)]
       # Make sure heap is right in both up and down direction.
       # Ideally only one of them will make any change.
       self._heapify_up(__snake_case	)
       self._heapify_down(__snake_case	)





    def 					_lowerCamelCase (	self				:   Dict       ,   __snake_case				:   int	):





       '''simple docstring'''
       if item not in self.pos_map:
          return
       UpperCAmelCase_							:      List[Any]						=   self.pos_map[item]
       del self.pos_map[item]
       UpperCAmelCase_							:      Union[str, Any]						=   self.arr[self.size - 1]
       UpperCAmelCase_							:      Optional[int]						=   index
       self.size -= 1
       # Make sure heap is right in both up and down direction. Ideally only one
       # of them will make any change- so no performance loss in calling both.
       if self.size > index:
          self._heapify_up(__snake_case	)
          self._heapify_down(__snake_case	)





    def 					_lowerCamelCase (	self				:   int       ,   __snake_case				:   int       ,   __snake_case				:   int	):





       '''simple docstring'''
       UpperCAmelCase_							:      Any						=   len(self.arr	)
       if arr_len == self.size:
          self.arr.append([item, self.key(__snake_case	)]	)
       else:
          UpperCAmelCase_							:      List[Any]						=   [item, self.key(__snake_case	)]
       UpperCAmelCase_							:      int						=   self.size
       self.size += 1
       self._heapify_up(self.size - 1	)





    def 					_lowerCamelCase (	self				:   int	):





       '''simple docstring'''
       return self.arr[0] if self.size else None





    def 					_lowerCamelCase (	self				:   str	):





       '''simple docstring'''
       UpperCAmelCase_							:      Tuple						=   self.get_top()
       if top_item_tuple:
          self.delete_item(top_item_tuple[0]	)
       return top_item_tuple





def      snake_case_						( ):
   pass


if __name__ == "__main__":
       import doctest

       doctest.testmod()



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


__UpperCamelCase				:  str      					=							logging.get_logger(__name__)

__UpperCamelCase				:  Any      					=							{
    'tiiuae/falcon-40b': 'https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json',
    'tiiuae/falcon-7b': 'https://huggingface.co/tiiuae/falcon-7b/resolve/main/config.json',
}





class  lowerCAmelCase__(    snake_case__						):






    '''simple docstring'''





    A_  :     int			= 'falcon'
    A_  :     int			= ['past_key_values']





    def __init__(	self				:   Optional[Any]       ,   __snake_case				:   Tuple=65_024       ,   __snake_case				:   List[str]=4_544       ,   __snake_case				:   Optional[Any]=32       ,   __snake_case				:   Any=71       ,   __snake_case				:   str=1E-5       ,   __snake_case				:   List[str]=0.02       ,   __snake_case				:   List[Any]=True       ,   __snake_case				:   Dict=0.0       ,   __snake_case				:   Optional[Any]=0.0       ,   __snake_case				:   Any=None       ,   __snake_case				:   List[Any]=False       ,   __snake_case				:   Dict=False       ,   __snake_case				:   Optional[int]=True       ,   __snake_case				:   List[Any]=True       ,   __snake_case				:   Optional[Any]=False       ,   __snake_case				:   Dict=11       ,   __snake_case				:   List[str]=11       ,   **__snake_case				:   int       ,   ):





       '''simple docstring'''
       UpperCAmelCase_							:      int						=   vocab_size
       # Backward compatibility with n_embed kwarg
       UpperCAmelCase_							:      Union[str, Any]						=   kwargs.pop('''n_embed'''       ,   __snake_case	)
       UpperCAmelCase_							:      str						=   hidden_size if n_embed is None else n_embed
       UpperCAmelCase_							:      Tuple						=   num_hidden_layers
       UpperCAmelCase_							:      Tuple						=   num_attention_heads
       UpperCAmelCase_							:      Optional[int]						=   layer_norm_epsilon
       UpperCAmelCase_							:      int						=   initializer_range
       UpperCAmelCase_							:      Optional[int]						=   use_cache
       UpperCAmelCase_							:      List[Any]						=   hidden_dropout
       UpperCAmelCase_							:      Any						=   attention_dropout

       UpperCAmelCase_							:      Tuple						=   bos_token_id
       UpperCAmelCase_							:      List[Any]						=   eos_token_id
       UpperCAmelCase_							:      Any						=   num_attention_heads if num_kv_heads is None else num_kv_heads
       UpperCAmelCase_							:      Optional[int]						=   alibi
       UpperCAmelCase_							:      Dict						=   new_decoder_architecture
       UpperCAmelCase_							:      List[Any]						=   multi_query  # Ignored when new_decoder_architecture is True
       UpperCAmelCase_							:      Tuple						=   parallel_attn
       UpperCAmelCase_							:      List[Any]						=   bias

       super().__init__(bos_token_id=__snake_case       ,   eos_token_id=__snake_case       ,   **__snake_case	)





    @property
    def 					_lowerCamelCase (	self				:   Optional[int]	):





       '''simple docstring'''
       return self.hidden_size // self.num_attention_heads





    @property
    def 					_lowerCamelCase (	self				:   Optional[int]	):





       '''simple docstring'''
       return not self.alibi