



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


_lowercase     							=						logging.get_logger(__name__)

_lowercase     							=						{
    '''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      ):
			UpperCamelCase					:str     =			'''falcon'''
			UpperCamelCase					:Any     =			['''past_key_values''']





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

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

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





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





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








from __future__ import annotations

import math
from collections import Counter
from string import ascii_lowercase






def      _A				(UpperCamelCase		:      str )  ->None:



			'''simple docstring'''







			lowerCamelCase__							,lowerCamelCase__ :      List[str]								=		analyze_text(UpperCamelCase )
			lowerCamelCase__ :      Any								=		list(""" """ + ascii_lowercase )
			# what is our total sum of probabilities.
			lowerCamelCase__ :      str								=		sum(single_char_strings.values() )

			# one length string
			lowerCamelCase__ :      Union[str, Any]								=		0
			# for each alpha we go in our dict and if it is in it we calculate entropy
			for ch in my_alphas:
						if ch in single_char_strings:
									lowerCamelCase__ :      List[Any]								=		single_char_strings[ch]
									lowerCamelCase__ :      List[str]								=		my_str / all_sum
									my_fir_sum += prob * math.loga(UpperCamelCase )  # entropy formula.

    # print entropy
			print(f"{round(-1 * my_fir_sum ):.1f}" )

			# two len string
			lowerCamelCase__ :      str								=		sum(two_char_strings.values() )
			lowerCamelCase__ :      int								=		0
			# for each alpha (two in size) calculate entropy.
			for cha in my_alphas:
						for cha in my_alphas:
									lowerCamelCase__ :      str								=		cha + cha
									if sequence in two_char_strings:
												lowerCamelCase__ :      str								=		two_char_strings[sequence]
												lowerCamelCase__ :      int								=		int(UpperCamelCase ) / all_sum
												my_sec_sum += prob * math.loga(UpperCamelCase )

    # print second entropy
			print(f"{round(-1 * my_sec_sum ):.1f}" )

			# print the difference between them
			print(f"{round((-1 * my_sec_sum) - (-1 * my_fir_sum) ):.1f}" )






def      _A				(UpperCamelCase		:      str )  ->tuple[dict, dict]:



			'''simple docstring'''







			lowerCamelCase__ :      Optional[int]								=		Counter()  # type: ignore
			lowerCamelCase__ :      List[Any]								=		Counter()  # type: ignore
			single_char_strings[text[-1]] += 1

			# first case when we have space at start.
			two_char_strings[" " + text[0]] += 1
			for i in range(0      ,			len(UpperCamelCase ) - 1 ):
						single_char_strings[text[i]] += 1
						two_char_strings[text[i : i + 2]] += 1
			return single_char_strings, two_char_strings






def      _A				()  ->List[str]:



			'''simple docstring'''







			import doctest

			doctest.testmod()
			# text = (
			#     "Had repulsive dashwoods suspicion sincerity but advantage now him. Remark "
			#     "easily garret nor nay. Civil those mrs enjoy shy fat merry. You greatest "
			#     "jointure saw horrible. He private he on be imagine suppose. Fertile "
			#     "beloved evident through no service elderly is. Blind there if every no so "
			#     "at. Own neglected you preferred way sincerity delivered his attempted. To "
			#     "of message cottage windows do besides against uncivil.  Delightful "
			#     "unreserved impossible few estimating men favourable see entreaties. She "
			#     "propriety immediate was improving. He or entrance humoured likewise "
			#     "moderate. Much nor game son say feel. Fat make met can must form into "
			#     "gate. Me we offending prevailed discovery. "
			# )

			# calculate_prob(text)


if __name__ == "__main__":
				main()



