





"""simple docstring"""






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


A	     =					logging.get_logger(__name__)

A	     =					{
    '''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 			__lowercase     (     lowerCamelCase_							):







     '''simple docstring'''




     __lowerCAmelCase					=					"""falcon"""
     __lowerCAmelCase					=					["""past_key_values"""]







     def __init__(  self		,     _UpperCAmelCase=65024		,     _UpperCAmelCase=4544		,     _UpperCAmelCase=32		,     _UpperCAmelCase=71		,     _UpperCAmelCase=1e-5		,     _UpperCAmelCase=0.0_2		,     _UpperCAmelCase=True		,     _UpperCAmelCase=0.0		,     _UpperCAmelCase=0.0		,     _UpperCAmelCase=None		,     _UpperCAmelCase=False		,     _UpperCAmelCase=False		,     _UpperCAmelCase=True		,     _UpperCAmelCase=True		,     _UpperCAmelCase=False		,     _UpperCAmelCase=11		,     _UpperCAmelCase=11		,     **_UpperCAmelCase		,     ):
         __a	:  List[str]         =					vocab_size
         # Backward compatibility with n_embed kwarg
         __a	:  Union[str, Any]         =					kwargs.pop('''n_embed'''		,     _UpperCAmelCase       )
         __a	:  Dict         =					hidden_size if n_embed is None else n_embed
         __a	:  Tuple         =					num_hidden_layers
         __a	:  Union[str, Any]         =					num_attention_heads
         __a	:  Tuple         =					layer_norm_epsilon
         __a	:  Optional[int]         =					initializer_range
         __a	:  Optional[Any]         =					use_cache
         __a	:  Any         =					hidden_dropout
         __a	:  Union[str, Any]         =					attention_dropout

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

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







     @property
     def 	_lowerCamelCase						(  self       ):
         return self.hidden_size // self.num_attention_heads







     @property
     def 	_lowerCamelCase						(  self       ):
         return not self.alibi






"""simple docstring"""






from __future__ import annotations

import sys
from collections import deque
from typing import Generic, TypeVar

A	     =					TypeVar('''T''')




class 			__lowercase     (     Generic[T]							):







					'''simple docstring'''




					__lowerCAmelCase					=					42  # Cache store of keys
					__lowerCAmelCase					=					42  # References of the keys in cache
					__lowerCAmelCase					=					10  # Maximum capacity of cache







					def __init__(  self		,     _UpperCAmelCase       ):
									__a	:  Optional[int]         =					deque()
									__a	:  Dict         =					set()
									if not n:
													__a	:  List[Any]         =					sys.maxsize
									elif n < 0:
													raise ValueError('''n should be an integer greater than 0.'''       )
									else:
													__a	:  str         =					n







					def 	_lowerCamelCase						(  self		,     _UpperCAmelCase       ):
									if x not in self.key_reference:
													if len(self.dq_store       ) == LRUCache._MAX_CAPACITY:
																	__a	:  int         =					self.dq_store.pop()
																	self.key_reference.remove(_UpperCAmelCase       )
									else:
													self.dq_store.remove(_UpperCAmelCase       )

									self.dq_store.appendleft(_UpperCAmelCase       )
									self.key_reference.add(_UpperCAmelCase       )







					def 	_lowerCamelCase						(  self       ):
									for k in self.dq_store:
													print(_UpperCAmelCase       )







					def __repr__(  self       ):
									return f"""LRUCache({self._MAX_CAPACITY}) => {list(self.dq_store       )}"""


if __name__ == "__main__":
		import doctest

		doctest.testmod()

		A	     =					LRUCache(4)
		lru_cache.refer('''A''')
		lru_cache.refer(2)
		lru_cache.refer(3)
		lru_cache.refer('''A''')
		lru_cache.refer(4)
		lru_cache.refer(5)
		lru_cache.display()

		print(lru_cache)
		assert str(lru_cache) == "LRUCache(4) => [5, 4, 'A', 3]"