



"""simple docstring"""







import argparse
import json

import gdown
import numpy as np
import torch
from huggingface_hub import hf_hub_download

from transformers import (
    VideoMAEConfig,
    VideoMAEForPreTraining,
    VideoMAEForVideoClassification,
    VideoMAEImageProcessor,
)

def 				UpperCamelCase_    (    lowerCAmelCase__      :				Any						)						->   List[Any]:

  """simple docstring"""




  lowerCAmelCase_   :				Optional[int]								= VideoMAEConfig()

  set_architecture_configs(lowerCamelCase__    ,   lowerCamelCase__						)

  if "finetuned" not in model_name:
    lowerCAmelCase_   :				Dict								= False

  if "finetuned" in model_name:
    lowerCAmelCase_   :				List[Any]								= """huggingface/label-files"""
    if "kinetics" in model_name:
      lowerCAmelCase_   :				Dict								= 400
      lowerCAmelCase_   :				List[str]								= """kinetics400-id2label.json"""
    elif "ssv2" in model_name:
      lowerCAmelCase_   :				Tuple								= 174
      lowerCAmelCase_   :				str								= """something-something-v2-id2label.json"""
    else:
      raise ValueError('Model name should either contain \'kinetics\' or \'ssv2\' in case it\'s fine-tuned.'						)
    lowerCAmelCase_   :				Dict								= json.load(open(hf_hub_download(lowerCamelCase__    ,   lowerCamelCase__    ,   repo_type='dataset'						)    ,   'r'						)						)
    lowerCAmelCase_   :				List[str]								= {int(lowerCamelCase__						): v for k, v in idalabel.items()}
    lowerCAmelCase_   :				Optional[Any]								= idalabel
    lowerCAmelCase_   :				Union[str, Any]								= {v: k for k, v in idalabel.items()}

  return config

def 				UpperCamelCase_    (    lowerCAmelCase__      :				Any    ,   lowerCAmelCase__      :				List[str]						)						->   List[Any]:

  """simple docstring"""




  if "small" in model_name:
    lowerCAmelCase_   :				int								= 384
    lowerCAmelCase_   :				Union[str, Any]								= 1536
    lowerCAmelCase_   :				List[str]								= 12
    lowerCAmelCase_   :				Optional[int]								= 16
    lowerCAmelCase_   :				Any								= 12
    lowerCAmelCase_   :				int								= 3
    lowerCAmelCase_   :				Optional[Any]								= 192
    lowerCAmelCase_   :				Union[str, Any]								= 768
  elif "large" in model_name:
    lowerCAmelCase_   :				List[Any]								= 1024
    lowerCAmelCase_   :				Optional[Any]								= 4096
    lowerCAmelCase_   :				Optional[Any]								= 24
    lowerCAmelCase_   :				List[str]								= 16
    lowerCAmelCase_   :				Any								= 12
    lowerCAmelCase_   :				str								= 8
    lowerCAmelCase_   :				str								= 512
    lowerCAmelCase_   :				int								= 2048
  elif "huge" in model_name:
    lowerCAmelCase_   :				Optional[Any]								= 1280
    lowerCAmelCase_   :				str								= 5120
    lowerCAmelCase_   :				str								= 32
    lowerCAmelCase_   :				int								= 16
    lowerCAmelCase_   :				Any								= 12
    lowerCAmelCase_   :				Union[str, Any]								= 8
    lowerCAmelCase_   :				Dict								= 640
    lowerCAmelCase_   :				Optional[Any]								= 2560
  elif "base" not in model_name:
    raise ValueError('Model name should include either \"small\", \"base\", \"large\", or \"huge\"'						)

def 				UpperCamelCase_    (    lowerCAmelCase__      :				str						)						->   Optional[int]:

  """simple docstring"""




  if "encoder." in name:
    lowerCAmelCase_   :				List[Any]								= name.replace('encoder.'    ,   ''						)
  if "cls_token" in name:
    lowerCAmelCase_   :				List[str]								= name.replace('cls_token'    ,   'videomae.embeddings.cls_token'						)
  if "decoder_pos_embed" in name:
    lowerCAmelCase_   :				Tuple								= name.replace('decoder_pos_embed'    ,   'decoder.decoder_pos_embed'						)
  if "pos_embed" in name and "decoder" not in name:
    lowerCAmelCase_   :				int								= name.replace('pos_embed'    ,   'videomae.embeddings.position_embeddings'						)
  if "patch_embed.proj" in name:
    lowerCAmelCase_   :				Optional[Any]								= name.replace('patch_embed.proj'    ,   'videomae.embeddings.patch_embeddings.projection'						)
  if "patch_embed.norm" in name:
    lowerCAmelCase_   :				Dict								= name.replace('patch_embed.norm'    ,   'videomae.embeddings.norm'						)
  if "decoder.blocks" in name:
    lowerCAmelCase_   :				List[str]								= name.replace('decoder.blocks'    ,   'decoder.decoder_layers'						)
  if "blocks" in name:
    lowerCAmelCase_   :				List[str]								= name.replace('blocks'    ,   'videomae.encoder.layer'						)
  if "attn.proj" in name:
    lowerCAmelCase_   :				str								= name.replace('attn.proj'    ,   'attention.output.dense'						)
  if "attn" in name and "bias" not in name:
    lowerCAmelCase_   :				str								= name.replace('attn'    ,   'attention.self'						)
  if "attn" in name:
    lowerCAmelCase_   :				Union[str, Any]								= name.replace('attn'    ,   'attention.attention'						)
  if "norm1" in name:
    lowerCAmelCase_   :				Any								= name.replace('norm1'    ,   'layernorm_before'						)
  if "norm2" in name:
    lowerCAmelCase_   :				List[str]								= name.replace('norm2'    ,   'layernorm_after'						)
  if "mlp.fc1" in name:
    lowerCAmelCase_   :				Dict								= name.replace('mlp.fc1'    ,   'intermediate.dense'						)
  if "mlp.fc2" in name:
    lowerCAmelCase_   :				List[str]								= name.replace('mlp.fc2'    ,   'output.dense'						)
  if "decoder_embed" in name:
    lowerCAmelCase_   :				Optional[Any]								= name.replace('decoder_embed'    ,   'decoder.decoder_embed'						)
  if "decoder_norm" in name:
    lowerCAmelCase_   :				Tuple								= name.replace('decoder_norm'    ,   'decoder.decoder_norm'						)
  if "decoder_pred" in name:
    lowerCAmelCase_   :				Tuple								= name.replace('decoder_pred'    ,   'decoder.decoder_pred'						)
  if "norm.weight" in name and "decoder" not in name and "fc" not in name:
    lowerCAmelCase_   :				Dict								= name.replace('norm.weight'    ,   'videomae.layernorm.weight'						)
  if "norm.bias" in name and "decoder" not in name and "fc" not in name:
    lowerCAmelCase_   :				List[str]								= name.replace('norm.bias'    ,   'videomae.layernorm.bias'						)
  if "head" in name and "decoder" not in name:
    lowerCAmelCase_   :				Optional[Any]								= name.replace('head'    ,   'classifier'						)

  return name

def 				UpperCamelCase_    (    lowerCAmelCase__      :				Tuple    ,   lowerCAmelCase__      :				str						)						->   Optional[Any]:

  """simple docstring"""




  for key in orig_state_dict.copy().keys():
    lowerCAmelCase_   :				str								= orig_state_dict.pop(lowerCamelCase__						)

    if key.startswith('encoder.'						):
      lowerCAmelCase_   :				Tuple								= key.replace('encoder.'    ,   ''						)

    if "qkv" in key:
      lowerCAmelCase_   :				Optional[int]								= key.split('.'						)
      if key.startswith('decoder.blocks'						):
        lowerCAmelCase_   :				Union[str, Any]								= config.decoder_hidden_size
        lowerCAmelCase_   :				Any								= int(key_split[2]						)
        lowerCAmelCase_   :				int								= """decoder.decoder_layers."""
        if "weight" in key:
          lowerCAmelCase_   :				Optional[Any]								= val[:dim, :]
          lowerCAmelCase_   :				Any								= val[dim : dim * 2, :]
          lowerCAmelCase_   :				Dict								= val[-dim:, :]
      else:
        lowerCAmelCase_   :				List[Any]								= config.hidden_size
        lowerCAmelCase_   :				List[Any]								= int(key_split[1]						)
        lowerCAmelCase_   :				int								= """videomae.encoder.layer."""
        if "weight" in key:
          lowerCAmelCase_   :				Any								= val[:dim, :]
          lowerCAmelCase_   :				Union[str, Any]								= val[dim : dim * 2, :]
          lowerCAmelCase_   :				List[str]								= val[-dim:, :]
    else:
      lowerCAmelCase_   :				Union[str, Any]								= val

  return orig_state_dict

def 				UpperCamelCase_    (    )						->   Optional[int]:

  """simple docstring"""




  lowerCAmelCase_   :				List[Any]								= hf_hub_download(
      repo_id='hf-internal-testing/spaghetti-video'    ,   filename='eating_spaghetti.npy'    ,   repo_type='dataset'						)
  lowerCAmelCase_   :				Optional[Any]								= np.load(lowerCamelCase__						)
  return list(lowerCamelCase__						)

def 				UpperCamelCase_    (    lowerCAmelCase__      :				int    ,   lowerCAmelCase__      :				int    ,   lowerCAmelCase__      :				Tuple    ,   lowerCAmelCase__      :				List[str]						)						->   Dict:

  """simple docstring"""




  lowerCAmelCase_   :				Any								= get_videomae_config(lowerCamelCase__						)

  if "finetuned" in model_name:
    lowerCAmelCase_   :				List[str]								= VideoMAEForVideoClassification(lowerCamelCase__						)
  else:
    lowerCAmelCase_   :				Optional[Any]								= VideoMAEForPreTraining(lowerCamelCase__						)

  # download original checkpoint, hosted on Google Drive
  lowerCAmelCase_   :				Optional[Any]								= """pytorch_model.bin"""
  gdown.cached_download(lowerCamelCase__    ,   lowerCamelCase__    ,   quiet=lowerCamelCase__						)
  lowerCAmelCase_   :				Any								= torch.load(lowerCamelCase__    ,   map_location='cpu'						)
  if "model" in files:
    lowerCAmelCase_   :				Any								= files["""model"""]
  else:
    lowerCAmelCase_   :				Dict								= files["""module"""]
  lowerCAmelCase_   :				Any								= convert_state_dict(lowerCamelCase__    ,   lowerCamelCase__						)

  model.load_state_dict(lowerCamelCase__						)
  model.eval()

  # verify model on basic input
  lowerCAmelCase_   :				int								= VideoMAEImageProcessor(image_mean=[0.5, 0.5, 0.5]    ,   image_std=[0.5, 0.5, 0.5]						)
  lowerCAmelCase_   :				Union[str, Any]								= prepare_video()
  lowerCAmelCase_   :				str								= image_processor(lowerCamelCase__    ,   return_tensors='pt'						)

  if "finetuned" not in model_name:
    lowerCAmelCase_   :				List[str]								= hf_hub_download(repo_id='hf-internal-testing/bool-masked-pos'    ,   filename='bool_masked_pos.pt'						)
    lowerCAmelCase_   :				Optional[Any]								= torch.load(lowerCamelCase__						)

  lowerCAmelCase_   :				Dict								= model(**lowerCamelCase__						)
  lowerCAmelCase_   :				List[Any]								= outputs.logits

  lowerCAmelCase_   :				Any								= [
      """videomae-small-finetuned-kinetics""",
      """videomae-small-finetuned-ssv2""",
      # Kinetics-400 checkpoints (short = pretrained only for 800 epochs instead of 1600)
      """videomae-base-short""",
      """videomae-base-short-finetuned-kinetics""",
      """videomae-base""",
      """videomae-base-finetuned-kinetics""",
      """videomae-large""",
      """videomae-large-finetuned-kinetics""",
      """videomae-huge-finetuned-kinetics""",
      # Something-Something-v2 checkpoints (short = pretrained only for 800 epochs instead of 2400)
      """videomae-base-short-ssv2""",
      """videomae-base-short-finetuned-ssv2""",
      """videomae-base-ssv2""",
      """videomae-base-finetuned-ssv2""",
  ]

  # NOTE: logits were tested with image_mean and image_std equal to [0.5, 0.5, 0.5] and [0.5, 0.5, 0.5]
  if model_name == "videomae-small-finetuned-kinetics":
    lowerCAmelCase_   :				str								= torch.Size([1, 400]						)
    lowerCAmelCase_   :				Optional[Any]								= torch.tensor([-0.9291, -0.4061, -0.9307]						)
  elif model_name == "videomae-small-finetuned-ssv2":
    lowerCAmelCase_   :				str								= torch.Size([1, 174]						)
    lowerCAmelCase_   :				Union[str, Any]								= torch.tensor([0.2671, -0.4689, -0.8235]						)
  elif model_name == "videomae-base":
    lowerCAmelCase_   :				Tuple								= torch.Size([1, 1408, 1536]						)
    lowerCAmelCase_   :				List[str]								= torch.tensor([[0.7739, 0.7968, 0.7089], [0.6701, 0.7487, 0.6209], [0.4287, 0.5158, 0.4773]]						)
  elif model_name == "videomae-base-short":
    lowerCAmelCase_   :				Dict								= torch.Size([1, 1408, 1536]						)
    lowerCAmelCase_   :				List[str]								= torch.tensor([[0.7994, 0.9612, 0.8508], [0.7401, 0.8958, 0.8302], [0.5862, 0.7468, 0.7325]]						)
    # we verified the loss both for normalized and unnormalized targets for this one
    lowerCAmelCase_   :				List[Any]								= torch.tensor([0.5142]						) if config.norm_pix_loss else torch.tensor([0.6469]						)
  elif model_name == "videomae-large":
    lowerCAmelCase_   :				str								= torch.Size([1, 1408, 1536]						)
    lowerCAmelCase_   :				Dict								= torch.tensor([[0.7149, 0.7997, 0.6966], [0.6768, 0.7869, 0.6948], [0.5139, 0.6221, 0.5605]]						)
  elif model_name == "videomae-large-finetuned-kinetics":
    lowerCAmelCase_   :				int								= torch.Size([1, 400]						)
    lowerCAmelCase_   :				Optional[Any]								= torch.tensor([0.0771, 0.0011, -0.3625]						)
  elif model_name == "videomae-huge-finetuned-kinetics":
    lowerCAmelCase_   :				Union[str, Any]								= torch.Size([1, 400]						)
    lowerCAmelCase_   :				Optional[int]								= torch.tensor([0.2433, 0.1632, -0.4894]						)
  elif model_name == "videomae-base-short-finetuned-kinetics":
    lowerCAmelCase_   :				List[Any]								= torch.Size([1, 400]						)
    lowerCAmelCase_   :				Optional[Any]								= torch.tensor([0.6588, 0.0990, -0.2493]						)
  elif model_name == "videomae-base-finetuned-kinetics":
    lowerCAmelCase_   :				Union[str, Any]								= torch.Size([1, 400]						)
    lowerCAmelCase_   :				Tuple								= torch.tensor([0.3669, -0.0688, -0.2421]						)
  elif model_name == "videomae-base-short-ssv2":
    lowerCAmelCase_   :				Optional[Any]								= torch.Size([1, 1408, 1536]						)
    lowerCAmelCase_   :				List[Any]								= torch.tensor([[0.4712, 0.5296, 0.5786], [0.2278, 0.2729, 0.4026], [0.0352, 0.0730, 0.2506]]						)
  elif model_name == "videomae-base-short-finetuned-ssv2":
    lowerCAmelCase_   :				Any								= torch.Size([1, 174]						)
    lowerCAmelCase_   :				Any								= torch.tensor([-0.0537, -0.1539, -0.3266]						)
  elif model_name == "videomae-base-ssv2":
    lowerCAmelCase_   :				Dict								= torch.Size([1, 1408, 1536]						)
    lowerCAmelCase_   :				Dict								= torch.tensor([[0.8131, 0.8727, 0.8546], [0.7366, 0.9377, 0.8870], [0.5935, 0.8874, 0.8564]]						)
  elif model_name == "videomae-base-finetuned-ssv2":
    lowerCAmelCase_   :				Any								= torch.Size([1, 174]						)
    lowerCAmelCase_   :				str								= torch.tensor([0.1961, -0.8337, -0.6389]						)
  else:
    raise ValueError(f"Model name not supported. Should be one of {model_names}"						)

  # verify logits
  assert logits.shape == expected_shape
  if "finetuned" in model_name:
    assert torch.allclose(logits[0, :3]    ,   lowerCamelCase__    ,   atol=1e-4						)
  else:
    print('Logits:'    ,   logits[0, :3, :3]						)
    assert torch.allclose(logits[0, :3, :3]    ,   lowerCamelCase__    ,   atol=1e-4						)
  print('Logits ok!'						)

  # verify loss, if applicable
  if model_name == "videomae-base-short":
    lowerCAmelCase_   :				Optional[int]								= outputs.loss
    assert torch.allclose(lowerCamelCase__    ,   lowerCamelCase__    ,   atol=1e-4						)
    print('Loss ok!'						)

  if pytorch_dump_folder_path is not None:
    print(f"Saving model and image processor to {pytorch_dump_folder_path}"						)
    image_processor.save_pretrained(lowerCamelCase__						)
    model.save_pretrained(lowerCamelCase__						)

  if push_to_hub:
    print('Pushing to the hub...'						)
    model.push_to_hub(lowerCamelCase__    ,   organization='nielsr'						)


if __name__ == "__main__":
     lowercase__		:				Tuple          =	argparse.ArgumentParser()
     # Required parameters
     parser.add_argument(
         """--checkpoint_url""",
         default="""https://drive.google.com/u/1/uc?id=1tEhLyskjb755TJ65ptsrafUG2llSwQE1&amp;export=download&amp;confirm=t&amp;uuid=aa3276eb-fb7e-482a-adec-dc7171df14c4""",
         type=str,
         help=(
             """URL of the original PyTorch checkpoint (on Google Drive) you\'d like to convert. Should be a direct"""
             """ download link."""
         ),
     )
     parser.add_argument(
         """--pytorch_dump_folder_path""",
         default="""/Users/nielsrogge/Documents/VideoMAE/Test""",
         type=str,
         help="""Path to the output PyTorch model directory.""",
     )
     parser.add_argument("""--model_name""", default="""videomae-base""", type=str, help="""Name of the model.""")
     parser.add_argument(
         """--push_to_hub""", action="""store_true""", help="""Whether or not to push the converted model to the 🤗 hub."""
     )

     lowercase__		:				Union[str, Any]          =	parser.parse_args()
     convert_videomae_checkpoint(args.checkpoint_url, args.pytorch_dump_folder_path, args.model_name, args.push_to_hub)










'''simple docstring'''




import argparse
import struct
import unittest







class 	_lowerCAmelCase							:


	def __init__(self       ,      lowercase							):
				A_	:						List[str]	=     data

				# Initialize hash values
				A_	:						Tuple	=     [
				    0X6A09_E667,
				    0XBB67_AE85,
				    0X3C6E_F372,
				    0XA54F_F53A,
				    0X510E_527F,
				    0X9B05_688C,
				    0X1F83_D9AB,
				    0X5BE0_CD19,
				]

				# Initialize round constants
				A_	:						List[Any]	=     [
				    0X428A_2F98,
				    0X7137_4491,
				    0XB5C0_FBCF,
				    0XE9B5_DBA5,
				    0X3956_C25B,
				    0X59F1_11F1,
				    0X923F_82A4,
				    0XAB1C_5ED5,
				    0XD807_AA98,
				    0X1283_5B01,
				    0X2431_85BE,
				    0X550C_7DC3,
				    0X72BE_5D74,
				    0X80DE_B1FE,
				    0X9BDC_06A7,
				    0XC19B_F174,
				    0XE49B_69C1,
				    0XEFBE_4786,
				    0X0FC1_9DC6,
				    0X240C_A1CC,
				    0X2DE9_2C6F,
				    0X4A74_84AA,
				    0X5CB0_A9DC,
				    0X76F9_88DA,
				    0X983E_5152,
				    0XA831_C66D,
				    0XB003_27C8,
				    0XBF59_7FC7,
				    0XC6E0_0BF3,
				    0XD5A7_9147,
				    0X06CA_6351,
				    0X1429_2967,
				    0X27B7_0A85,
				    0X2E1B_2138,
				    0X4D2C_6DFC,
				    0X5338_0D13,
				    0X650A_7354,
				    0X766A_0ABB,
				    0X81C2_C92E,
				    0X9272_2C85,
				    0XA2BF_E8A1,
				    0XA81A_664B,
				    0XC24B_8B70,
				    0XC76C_51A3,
				    0XD192_E819,
				    0XD699_0624,
				    0XF40E_3585,
				    0X106A_A070,
				    0X19A4_C116,
				    0X1E37_6C08,
				    0X2748_774C,
				    0X34B0_BCB5,
				    0X391C_0CB3,
				    0X4ED8_AA4A,
				    0X5B9C_CA4F,
				    0X682E_6FF3,
				    0X748F_82EE,
				    0X78A5_636F,
				    0X84C8_7814,
				    0X8CC7_0208,
				    0X90BE_FFFA,
				    0XA450_6CEB,
				    0XBEF9_A3F7,
				    0XC671_78F2,
				]

				A_	:						Tuple	=     self.preprocessing(self.data							)
				self.final_hash()


	@staticmethod
	def     _a	(lowercase							):
				A_	:						Any	=     b"""\x80""" + (b"""\x00""" * (63 - (len(lowercase							) + 8) % 64))
				A_	:						Optional[Any]	=     struct.pack(""">Q"""       ,      (len(lowercase							) * 8)							)
				return data + padding + big_endian_integer


	def     _a	(self							):
				# Convert into blocks of 64 bytes
				A_	:						str	=     [
				    self.preprocessed_data[x : x + 64]
				    for x in range(0       ,      len(self.preprocessed_data							)       ,      64							)
				]

				for block in self.blocks:
							# Convert the given block into a list of 4 byte integers
							A_	:						Tuple	=     list(struct.unpack(""">16L"""       ,      lowercase							)							)
							# add 48 0-ed integers
							words += [0] * 48

							A_,    A_,    A_,    A_,    A_,    A_,    A_,    A_	:						Dict	=     self.hashes

							for index in range(0       ,      64							):
										if index > 15:
													# modify the zero-ed indexes at the end of the array
													A_	:						Optional[Any]	=     (
													    self.ror(words[index - 15]       ,      7							)
													    ^ self.ror(words[index - 15]       ,      18							)
													    ^ (words[index - 15] >> 3)
													)
													A_	:						Tuple	=     (
													    self.ror(words[index - 2]       ,      17							)
													    ^ self.ror(words[index - 2]       ,      19							)
													    ^ (words[index - 2] >> 10)
													)

													A_	:						Any	=     (
													    words[index - 16] + sa + words[index - 7] + sa
													) % 0X1_0000_0000

										# Compression
										A_	:						Union[str, Any]	=     self.ror(lowercase       ,      6							) ^ self.ror(lowercase       ,      11							) ^ self.ror(lowercase       ,      25							)
										A_	:						List[Any]	=     (e & f) ^ ((~e & 0XFFFF_FFFF) & g)
										A_	:						Dict	=     (
										    h + sa + ch + self.round_constants[index] + words[index]
										) % 0X1_0000_0000
										A_	:						List[str]	=     self.ror(lowercase       ,      2							) ^ self.ror(lowercase       ,      13							) ^ self.ror(lowercase       ,      22							)
										A_	:						str	=     (a & b) ^ (a & c) ^ (b & c)
										A_	:						int	=     (sa + maj) % 0X1_0000_0000

										A_,    A_,    A_,    A_,    A_,    A_,    A_,    A_	:						List[Any]	=     (
										    g,
										    f,
										    e,
										    ((d + tempa) % 0X1_0000_0000),
										    c,
										    b,
										    a,
										    ((tempa + tempa) % 0X1_0000_0000),
										)

							A_	:						int	=     [a, b, c, d, e, f, g, h]

							# Modify final values
							A_	:						Dict	=     [
							    ((element + mutated_hash_values[index]) % 0X1_0000_0000)
							    for index, element in enumerate(self.hashes							)
							]

				A_	:						Any	=     """""".join([hex(lowercase							)[2:].zfill(8							) for value in self.hashes]							)


	def     _a	(self       ,      lowercase       ,      lowercase							):
				return 0XFFFF_FFFF & (value << (32 - rotations)) | (value >> rotations)







class 	_lowerCAmelCase							(			unittest.TestCase ):


	def     _a	(self							):
				import hashlib

				A_	:						Optional[Any]	=     bytes("""Test String"""       ,      """utf-8"""							)
				self.assertEqual(SHAaaa(lowercase							).hash       ,      hashlib.shaaaa(lowercase							).hexdigest()							)






def 	a			( ):
			'''simple docstring'''





			import doctest

			doctest.testmod()

			A_	:						Any	=     argparse.ArgumentParser()
			parser.add_argument(
			    """-s"""						,      """--string"""						,      dest="""input_string"""						,      default="""Hello World!! Welcome to Cryptography"""						,      help="""Hash the string"""						,      )
			parser.add_argument(
			    """-f"""						,      """--file"""						,      dest="""input_file"""						,      help="""Hash contents of a file"""    )

			A_	:						List[str]	=     parser.parse_args()

			A_	:						Tuple	=     args.input_string

			# hash input should be a bytestring
			if args.input_file:
						with open(args.input_file						,      """rb"""    ) as f:
									A_	:						Union[str, Any]	=     f.read()
			else:
						A_	:						Optional[Any]	=     bytes(lowerCamelCase__						,      """utf-8"""    )

			print(SHAaaa(lowerCamelCase__    ).hash    )


if __name__ == "__main__":
						main()