





'''simple docstring'''





import argparse
import hashlib  # hashlib is only used inside the Test class
import struct



class      _SCREAMING_SNAKE_CASE		:







 '''simple docstring'''

 def __init__(self       :     Optional[Any] ,				UpperCAmelCase_       :     int) ->str:



   '''simple docstring'''



   lowerCamelCase__:   Tuple    						=data
   lowerCamelCase__:   Optional[int]    						=[0x6745_2301, 0xEFCD_AB89, 0x98BA_DCFE, 0x1032_5476, 0xC3D2_E1F0]

 @staticmethod
 def 							SCREAMING_SNAKE_CASE_      (UpperCAmelCase_       :     str ,				UpperCAmelCase_       :     Union[str, Any]) ->Optional[int]:



   '''simple docstring'''



   return ((n << b) | (n >> (32 - b))) & 0xFFFF_FFFF

 def 							SCREAMING_SNAKE_CASE_      (self       :     List[Any]) ->Dict:



   '''simple docstring'''



   lowerCamelCase__:   Union[str, Any]    						=b"\x80" + b"\x00" * (63 - (len(self.data) + 8) % 64)
   lowerCamelCase__:   int    						=self.data + padding + struct.pack(">Q" ,				8 * len(self.data))
   return padded_data

 def 							SCREAMING_SNAKE_CASE_      (self       :     Optional[Any]) ->Optional[int]:



   '''simple docstring'''



   return [
       self.padded_data[i : i + 64] for i in range(0 ,				len(self.padded_data) ,				64)
   ]

 def 							SCREAMING_SNAKE_CASE_      (self       :     Union[str, Any] ,				UpperCAmelCase_       :     Dict) ->Tuple:



   '''simple docstring'''



   lowerCamelCase__:   Union[str, Any]    						=list(struct.unpack(">16L" ,				UpperCamelCase__)) + [0] * 64
   for i in range(16 ,				80):
     lowerCamelCase__:   Optional[Any]    						=self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]) ,				1)
   return w







 def 							SCREAMING_SNAKE_CASE_      (self       :     str) ->str:



   '''simple docstring'''



   lowerCamelCase__:   Tuple    						=self.padding()
   lowerCamelCase__:   List[Any]    						=self.split_blocks()
   for block in self.blocks:
     lowerCamelCase__:   List[str]    						=self.expand_block(UpperCamelCase__)
     lowerCamelCase__						,      lowerCamelCase__						,      lowerCamelCase__						,      lowerCamelCase__						,      lowerCamelCase__:   int    						=self.h
     for i in range(0 ,				80):
       if 0 <= i < 20:
         lowerCamelCase__:   Dict    						=(b & c) | ((~b) & d)
         lowerCamelCase__:   str    						=0x5A82_7999
       elif 20 <= i < 40:
         lowerCamelCase__:   List[str]    						=b ^ c ^ d
         lowerCamelCase__:   Optional[Any]    						=0x6ED9_EBA1
       elif 40 <= i < 60:
         lowerCamelCase__:   Optional[Any]    						=(b & c) | (b & d) | (c & d)
         lowerCamelCase__:   Optional[int]    						=0x8F1B_BCDC
       elif 60 <= i < 80:
         lowerCamelCase__:   Tuple    						=b ^ c ^ d
         lowerCamelCase__:   List[Any]    						=0xCA62_C1D6
       lowerCamelCase__						,      lowerCamelCase__						,      lowerCamelCase__						,      lowerCamelCase__						,      lowerCamelCase__:   Tuple    						=(
           self.rotate(UpperCamelCase__ ,				5) + f + e + k + expanded_block[i] & 0xFFFF_FFFF,
           a,
           self.rotate(UpperCamelCase__ ,				30),
           c,
           d,
       )
     lowerCamelCase__:   List[Any]    						=(
         self.h[0] + a & 0xFFFF_FFFF,
         self.h[1] + b & 0xFFFF_FFFF,
         self.h[2] + c & 0xFFFF_FFFF,
         self.h[3] + d & 0xFFFF_FFFF,
         self.h[4] + e & 0xFFFF_FFFF,
     )
   return ("{:08x}" * 5).format(*self.h)





def   lowerCAmelCase_				( )  ->	List[str]:







  """simple docstring"""





  lowerCamelCase__:   Tuple    						=b"Test String"
  assert SHAaHash(_lowerCamelCase	).final_hash() == hashlib.shaa(_lowerCamelCase	).hexdigest()  # noqa: S324





def   lowerCAmelCase_				( )  ->	Optional[int]:







  """simple docstring"""





  lowerCamelCase__:   Union[str, Any]    						=argparse.ArgumentParser(description="Process some strings or files"	)
  parser.add_argument(
      "--string"			,					dest="input_string"			,					default="Hello World!! Welcome to Cryptography"			,					help="Hash the string"			,					)
  parser.add_argument("--file"			,					dest="input_file"			,					help="Hash contents of a file"	)
  lowerCamelCase__:   Union[str, Any]    						=parser.parse_args()
  lowerCamelCase__:   Optional[int]    						=args.input_string
  # In any case hash input should be a bytestring
  if args.input_file:
    with open(args.input_file			,					"rb"	) as f:
      lowerCamelCase__:   Tuple    						=f.read()
  else:
    lowerCamelCase__:   Optional[int]    						=bytes(_lowerCamelCase			,					"utf-8"	)
  print(SHAaHash(_lowerCamelCase	).final_hash()	)


if __name__ == "__main__":
     main()
     import doctest

     doctest.testmod()








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      _SCREAMING_SNAKE_CASE		(			__SCREAMING_SNAKE_CASE					):







 '''simple docstring'''
 lowercase_	=    "falcon"
 lowercase_	=    ["past_key_values"]

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



   '''simple docstring'''



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

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

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

 @property
 def 							SCREAMING_SNAKE_CASE_      (self       :     List[Any]) ->Dict:



   '''simple docstring'''



   return self.hidden_size // self.num_attention_heads







 @property
 def 							SCREAMING_SNAKE_CASE_      (self       :     Dict) ->List[Any]:



   '''simple docstring'''



   return not self.alibi

