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


UpperCamelCase_   	=	logging.get_logger(__name__)

UpperCamelCase_   	=	{
    "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       a		(   __UpperCAmelCase					):
							lowercase_		:						int   							=  'falcon'
							lowercase_		:						int   							=  ['past_key_values']







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







								__lowerCAmelCase         =							vocab_size
								# Backward compatibility with n_embed kwarg
								__lowerCAmelCase         =							kwargs.pop("n_embed"      ,				snake_case__ )
								__lowerCAmelCase         =							hidden_size if n_embed is None else n_embed
								__lowerCAmelCase         =							num_hidden_layers
								__lowerCAmelCase         =							num_attention_heads
								__lowerCAmelCase         =							layer_norm_epsilon
								__lowerCAmelCase         =							initializer_range
								__lowerCAmelCase         =							use_cache
								__lowerCAmelCase         =							hidden_dropout
								__lowerCAmelCase         =							attention_dropout

								__lowerCAmelCase         =							bos_token_id
								__lowerCAmelCase         =							eos_token_id
								__lowerCAmelCase         =							num_attention_heads if num_kv_heads is None else num_kv_heads
								__lowerCAmelCase         =							alibi
								__lowerCAmelCase         =							new_decoder_architecture
								__lowerCAmelCase         =							multi_query  # Ignored when new_decoder_architecture is True
								__lowerCAmelCase         =							parallel_attn
								__lowerCAmelCase         =							bias

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







							@property
							def       UpperCAmelCase__					(						self  :  Optional[int] ):
								"""simple docstring"""







								return self.hidden_size // self.num_attention_heads







							@property
							def       UpperCAmelCase__					(						self  :  Optional[Any] ):
								"""simple docstring"""







								return not self.alibi








from __future__ import annotations

from collections.abc import Iterator
from typing import Any

class       a		:







							def __init__(						self  :  Optional[int]      ,				snake_case__  :  Any ):
								"""simple docstring"""







								__lowerCAmelCase         =							data
								__lowerCAmelCase         =							None

class       a		:







							def __init__(						self  :  Optional[Any] ):
								"""simple docstring"""







								__lowerCAmelCase         =							None
								__lowerCAmelCase         =							None







							def __iter__(						self  :  Dict ):
								"""simple docstring"""







								__lowerCAmelCase         =							self.head
								while self.head:
									yield node.data
									__lowerCAmelCase         =							node.next
									if node == self.head:
										break







							def __len__(						self  :  Dict ):
								"""simple docstring"""







								return sum(1 for _ in self )







							def __repr__(						self  :  str ):
								"""simple docstring"""







								return "->".join(str(snake_case__ ) for item in iter(self ) )







							def       UpperCAmelCase__					(						self  :  Optional[Any]      ,				snake_case__  :  Any ):
								"""simple docstring"""







								self.insert_nth(len(self )      ,				snake_case__ )







							def       UpperCAmelCase__					(						self  :  Union[str, Any]      ,				snake_case__  :  Any ):
								"""simple docstring"""







								self.insert_nth(0      ,				snake_case__ )







							def       UpperCAmelCase__					(						self  :  List[Any]      ,				snake_case__  :  int      ,				snake_case__  :  Any ):
								"""simple docstring"""







								if index < 0 or index > len(self ):
									raise IndexError("list index out of range." )
								__lowerCAmelCase         =							Node(snake_case__ )
								if self.head is None:
									__lowerCAmelCase         =							new_node  # first node points itself
									__lowerCAmelCase         =							__lowerCAmelCase         =							new_node
								elif index == 0:  # insert at head
									__lowerCAmelCase         =							self.head
									__lowerCAmelCase         =							__lowerCAmelCase         =							new_node
								else:
									__lowerCAmelCase         =							self.head
									for _ in range(index - 1 ):
										__lowerCAmelCase         =							temp.next
									__lowerCAmelCase         =							temp.next
									__lowerCAmelCase         =							new_node
									if index == len(self ) - 1:  # insert at tail
										__lowerCAmelCase         =							new_node







							def       UpperCAmelCase__					(						self  :  List[Any] ):
								"""simple docstring"""







								return self.delete_nth(0 )







							def       UpperCAmelCase__					(						self  :  Union[str, Any] ):
								"""simple docstring"""







								return self.delete_nth(len(self ) - 1 )







							def       UpperCAmelCase__					(						self  :  str      ,				snake_case__  :  int = 0 ):
								"""simple docstring"""







								if not 0 <= index < len(self ):
									raise IndexError("list index out of range." )
								__lowerCAmelCase         =							self.head
								if self.head == self.tail:  # just one node
									__lowerCAmelCase         =							__lowerCAmelCase         =							None
								elif index == 0:  # delete head node
									__lowerCAmelCase         =							self.tail.next.next
									__lowerCAmelCase         =							self.head.next
								else:
									__lowerCAmelCase         =							self.head
									for _ in range(index - 1 ):
										__lowerCAmelCase         =							temp.next
									__lowerCAmelCase         =							temp.next
									__lowerCAmelCase         =							temp.next.next
									if index == len(self ) - 1:  # delete at tail
										__lowerCAmelCase         =							temp
								return delete_node.data







							def       UpperCAmelCase__					(						self  :  str ):
								"""simple docstring"""







								return len(self ) == 0






def 		_UpperCAmelCase   (	):






	"""simple docstring"""


	__lowerCAmelCase         =							CircularLinkedList()
	assert len(UpperCamelCase  ) == 0
	assert circular_linked_list.is_empty() is True
	assert str(UpperCamelCase  ) == ""

	try:
		circular_linked_list.delete_front()
		raise AssertionError  # This should not happen
	except IndexError:
		assert True  # This should happen

	try:
		circular_linked_list.delete_tail()
		raise AssertionError  # This should not happen
	except IndexError:
		assert True  # This should happen

	try:
		circular_linked_list.delete_nth(-1  )
		raise AssertionError
	except IndexError:
		assert True

	try:
		circular_linked_list.delete_nth(0  )
		raise AssertionError
	except IndexError:
		assert True

	assert circular_linked_list.is_empty() is True
	for i in range(5  ):
		assert len(UpperCamelCase  ) == i
		circular_linked_list.insert_nth(UpperCamelCase			,							i + 1  )
	assert str(UpperCamelCase  ) == "->".join(str(UpperCamelCase  ) for i in range(1			,							6  )  )

	circular_linked_list.insert_tail(6  )
	assert str(UpperCamelCase  ) == "->".join(str(UpperCamelCase  ) for i in range(1			,							7  )  )
	circular_linked_list.insert_head(0  )
	assert str(UpperCamelCase  ) == "->".join(str(UpperCamelCase  ) for i in range(0			,							7  )  )

	assert circular_linked_list.delete_front() == 0
	assert circular_linked_list.delete_tail() == 6
	assert str(UpperCamelCase  ) == "->".join(str(UpperCamelCase  ) for i in range(1			,							6  )  )
	assert circular_linked_list.delete_nth(2  ) == 3

	circular_linked_list.insert_nth(2			,							3  )
	assert str(UpperCamelCase  ) == "->".join(str(UpperCamelCase  ) for i in range(1			,							6  )  )

	assert circular_linked_list.is_empty() is False


if __name__ == "__main__":
					import doctest

					doctest.testmod()






