'''simple docstring'''


import argparse

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

from transformers import (
    CLIPTokenizer,
    CLIPTokenizerFast,
    VideoMAEImageProcessor,
    XCLIPConfig,
    XCLIPModel,
    XCLIPProcessor,
    XCLIPTextConfig,
    XCLIPVisionConfig,
)

def   A_      (       SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)			->Tuple:
  lowercase_     =       XCLIPTextConfig()

  # derive patch size from model name
  lowercase_     =       model_name.find("""patch"""						)
  lowercase_     =       int(model_name[start_idx + len("""patch"""						) : start_idx + len("""patch"""						) + 2]						)
  lowercase_     =       XCLIPVisionConfig(patch_size=SCREAMING_SNAKE_CASE_ ,	num_frames=SCREAMING_SNAKE_CASE_						)

  if "large" in model_name:
    lowercase_     =       7_68
    lowercase_     =       30_72
    lowercase_     =       12

    lowercase_     =       10_24
    lowercase_     =       40_96
    lowercase_     =       16
    lowercase_     =       24
    lowercase_     =       7_68
    lowercase_     =       30_72

  if model_name == "xclip-large-patch14-16-frames":
    lowercase_     =       3_36

  lowercase_     =       XCLIPConfig.from_text_vision_configs(SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)

  if "large" in model_name:
    lowercase_     =       7_68

  return config

def   A_      (       SCREAMING_SNAKE_CASE_						)			->Any:
  # text encoder
  if name == "token_embedding.weight":
    lowercase_     =       name.replace("""token_embedding.weight""" ,	"""text_model.embeddings.token_embedding.weight"""						)
  if name == "positional_embedding":
    lowercase_     =       name.replace("""positional_embedding""" ,	"""text_model.embeddings.position_embedding.weight"""						)
  if "ln_1" in name:
    lowercase_     =       name.replace("""ln_1""" ,	"""layer_norm1"""						)
  if "ln_2" in name:
    lowercase_     =       name.replace("""ln_2""" ,	"""layer_norm2"""						)
  if "c_fc" in name:
    lowercase_     =       name.replace("""c_fc""" ,	"""fc1"""						)
  if "c_proj" in name:
    lowercase_     =       name.replace("""c_proj""" ,	"""fc2"""						)
  if name.startswith("""transformer.resblocks"""						):
    lowercase_     =       name.replace("""transformer.resblocks""" ,	"""text_model.encoder.layers"""						)
  if "attn.out_proj" in name and "message" not in name:
    lowercase_     =       name.replace("""attn.out_proj""" ,	"""self_attn.out_proj"""						)
  if "ln_final" in name:
    lowercase_     =       name.replace("""ln_final""" ,	"""text_model.final_layer_norm"""						)
  # visual encoder
  if name == "visual.class_embedding":
    lowercase_     =       name.replace("""visual.class_embedding""" ,	"""vision_model.embeddings.class_embedding"""						)
  if name == "visual.positional_embedding":
    lowercase_     =       name.replace("""visual.positional_embedding""" ,	"""vision_model.embeddings.position_embedding.weight"""						)
  if name.startswith("""visual.transformer.resblocks"""						):
    lowercase_     =       name.replace("""visual.transformer.resblocks""" ,	"""vision_model.encoder.layers"""						)
  if "visual.conv1" in name:
    lowercase_     =       name.replace("""visual.conv1""" ,	"""vision_model.embeddings.patch_embedding"""						)
  if "visual.ln_pre" in name:
    lowercase_     =       name.replace("""visual.ln_pre""" ,	"""vision_model.pre_layernorm"""						)
  if "visual.ln_post" in name:
    lowercase_     =       name.replace("""visual.ln_post""" ,	"""vision_model.post_layernorm"""						)
  if "visual.proj" in name:
    lowercase_     =       name.replace("""visual.proj""" ,	"""visual_projection.weight"""						)
  if "text_projection" in name:
    lowercase_     =       name.replace("""text_projection""" ,	"""text_projection.weight"""						)
  # things on top
  if "prompts_visual_proj" in name:
    lowercase_     =       name.replace("""prompts_visual_proj""" ,	"""prompts_visual_projection"""						)
  if "prompts_visual_ln" in name:
    lowercase_     =       name.replace("""prompts_visual_ln""" ,	"""prompts_visual_layernorm"""						)
  # mit
  if name == "mit.positional_embedding":
    lowercase_     =       name.replace("""positional""" ,	"""position"""						)
  if name.startswith("""mit.resblocks"""						):
    lowercase_     =       name.replace("""mit.resblocks""" ,	"""mit.encoder.layers"""						)
  # prompts generator
  if name.startswith("""prompts_generator.norm"""						):
    lowercase_     =       name.replace("""prompts_generator.norm""" ,	"""prompts_generator.layernorm"""						)

  return name

def   A_      (       SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)			->Dict:
  for key in orig_state_dict.copy().keys():
    lowercase_     =       orig_state_dict.pop(SCREAMING_SNAKE_CASE_						)

    if "attn.in_proj" in key:
      lowercase_     =       key.split("""."""						)
      if key.startswith("""visual"""						):
        lowercase_     =       key_split[3]
        lowercase_     =       config.vision_config.hidden_size
        if "message_attn" in key:
          if "weight" in key:
            lowercase_     =       val[
                :dim, :
            ]
            lowercase_     =       val[
                dim : dim * 2, :
            ]
            lowercase_     =       val[
                -dim:, :
            ]
          else:
            lowercase_     =       val[
                :dim
            ]
            lowercase_     =       val[
                dim : dim * 2
            ]
            lowercase_     =       val[
                -dim:
            ]
        else:
          if "weight" in key:
            lowercase_     =       val[
                :dim, :
            ]
            lowercase_     =       val[
                dim : dim * 2, :
            ]
            lowercase_     =       val[
                -dim:, :
            ]
          else:
            lowercase_     =       val[:dim]
            lowercase_     =       val[
                dim : dim * 2
            ]
            lowercase_     =       val[-dim:]
      elif key.startswith("""mit"""						):
        lowercase_     =       key_split[2]
        lowercase_     =       config.vision_config.mit_hidden_size
        if "weight" in key:
          lowercase_     =       val[:dim, :]
          lowercase_     =       val[dim : dim * 2, :]
          lowercase_     =       val[-dim:, :]
        else:
          lowercase_     =       val[:dim]
          lowercase_     =       val[dim : dim * 2]
          lowercase_     =       val[-dim:]
      else:
        lowercase_     =       key_split[2]
        lowercase_     =       config.text_config.hidden_size
        if "weight" in key:
          lowercase_     =       val[:dim, :]
          lowercase_     =       val[
              dim : dim * 2, :
          ]
          lowercase_     =       val[-dim:, :]
        else:
          lowercase_     =       val[:dim]
          lowercase_     =       val[
              dim : dim * 2
          ]
          lowercase_     =       val[-dim:]
    else:
      lowercase_     =       rename_key(SCREAMING_SNAKE_CASE_						)
      if new_key_name in ["visual_projection.weight", "text_projection.weight"]:
        lowercase_     =       val.T
      lowercase_     =       val

  return orig_state_dict

def   A_      (       SCREAMING_SNAKE_CASE_						)			->Dict:
  if num_frames == 8:
    lowercase_     =       """eating_spaghetti_8_frames.npy"""
  elif num_frames == 16:
    lowercase_     =       """eating_spaghetti.npy"""
  elif num_frames == 32:
    lowercase_     =       """eating_spaghetti_32_frames.npy"""
  lowercase_     =       hf_hub_download(
      repo_id="""hf-internal-testing/spaghetti-video""" ,	filename=SCREAMING_SNAKE_CASE_ ,	repo_type="""dataset""" ,	)
  lowercase_     =       np.load(SCREAMING_SNAKE_CASE_						)
  return list(SCREAMING_SNAKE_CASE_						)

def   A_      (       SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_=None ,	SCREAMING_SNAKE_CASE_=False						)			->Optional[Any]:
  lowercase_     =       {
      # fully supervised kinetics-400 checkpoints
      """xclip-base-patch32""": """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/k400_32_8.pth""",
      """xclip-base-patch32-16-frames""": (
          """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/k400_32_16.pth"""
      ),
      """xclip-base-patch16""": """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/k400_16_8.pth""",
      """xclip-base-patch16-16-frames""": (
          """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/k400_16_16.pth"""
      ),
      """xclip-large-patch14""": """https://drive.google.com/u/0/uc?id=1NUOImq0o5DlQTST17iIP3vG7DgmHQuCx&amp;export=download&amp;confirm=t&amp;uuid=b26caedc-88e2-473e-830a-9d158b653cdb""",
      """xclip-large-patch14-16-frames""": """https://drive.google.com/u/0/uc?id=1FOYgnJc097OJ4lGwtRCCydQyVPJEOH7d&amp;export=download&amp;confirm=t&amp;uuid=538fa810-e671-4050-b385-9a623f89804f""",
      # fully supervised kinetics-600 checkpoints
      """xclip-base-patch16-kinetics-600""": (
          """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/k600_16_8.pth"""
      ),
      """xclip-base-patch16-kinetics-600-16-frames""": (
          """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/k600_16_16.pth"""
      ),
      """xclip-large-patch14-kinetics-600""": """https://drive.google.com/u/0/uc?id=1FV8C1INuM91sLAN4ImjzePLIlpMSihwV&amp;export=download&amp;confirm=t&amp;uuid=141d4977-4a65-44ae-864f-4b0c19f838be""",
      # few shot
      """xclip-base-patch16-hmdb-2-shot""": (
          """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/few_hmdb_2.pth"""
      ),
      """xclip-base-patch16-hmdb-4-shot""": (
          """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/few_hmdb_4.pth"""
      ),
      """xclip-base-patch16-hmdb-8-shot""": (
          """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/few_hmdb_8.pth"""
      ),
      """xclip-base-patch16-hmdb-16-shot""": (
          """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/few_hmdb_16.pth"""
      ),
      """xclip-base-patch16-ucf-2-shot""": (
          """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/few_ucf_2.pth"""
      ),
      """xclip-base-patch16-ucf-4-shot""": (
          """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/few_ucf_4.pth"""
      ),
      """xclip-base-patch16-ucf-8-shot""": (
          """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/few_ucf_8.pth"""
      ),
      """xclip-base-patch16-ucf-16-shot""": (
          """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/few_ucf_16.pth"""
      ),
      # zero shot
      """xclip-base-patch16-zero-shot""": """https://github.com/nbl97/X-CLIP_Model_Zoo/releases/download/v1.0/zero.pth""",
  }

  lowercase_     =       model_to_url[model_name]
  lowercase_     =       8
  if "16-frames" in model_name:
    lowercase_     =       16
  elif "shot" in model_name:
    lowercase_     =       32

  lowercase_     =       get_xclip_config(SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)
  lowercase_     =       XCLIPModel(SCREAMING_SNAKE_CASE_						)
  model.eval()

  if "drive" in checkpoint_url:
    lowercase_     =       """pytorch_model.bin"""
    gdown.cached_download(SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	quiet=SCREAMING_SNAKE_CASE_						)
    lowercase_     =       torch.load(SCREAMING_SNAKE_CASE_ ,	map_location="""cpu"""						)["""model"""]
  else:
    lowercase_     =       torch.hub.load_state_dict_from_url(SCREAMING_SNAKE_CASE_						)["""model"""]

  lowercase_     =       convert_state_dict(SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)

  lowercase_     =       XCLIPModel(SCREAMING_SNAKE_CASE_						)
  lowercase_     ,	lowercase_     =       model.load_state_dict(SCREAMING_SNAKE_CASE_ ,	strict=SCREAMING_SNAKE_CASE_						)
  assert missing_keys == ["text_model.embeddings.position_ids", "vision_model.embeddings.position_ids"]
  model.eval()

  lowercase_     =       3_36 if model_name == """xclip-large-patch14-16-frames""" else 2_24
  lowercase_     =       VideoMAEImageProcessor(size=SCREAMING_SNAKE_CASE_						)
  lowercase_     =       CLIPTokenizer.from_pretrained("""openai/clip-vit-base-patch32"""						)
  lowercase_     =       CLIPTokenizerFast.from_pretrained("""openai/clip-vit-base-patch32"""						)
  lowercase_     =       XCLIPProcessor(image_processor=SCREAMING_SNAKE_CASE_ ,	tokenizer=SCREAMING_SNAKE_CASE_						)

  lowercase_     =       prepare_video(SCREAMING_SNAKE_CASE_						)
  lowercase_     =       processor(
      text=["""playing sports""", """eating spaghetti""", """go shopping"""] ,	videos=SCREAMING_SNAKE_CASE_ ,	return_tensors="""pt""" ,	padding=SCREAMING_SNAKE_CASE_						)

  print("""Shape of pixel values:""" ,	inputs.pixel_values.shape						)

  with torch.no_grad():
    lowercase_     =       model(**SCREAMING_SNAKE_CASE_						)

  # Verify outputs
  lowercase_     =       outputs.logits_per_video
  lowercase_     =       logits_per_video.softmax(dim=1						)
  print("""Probs:""" ,	SCREAMING_SNAKE_CASE_						)
  # kinetics-400
  if model_name == "xclip-base-patch32":
    lowercase_     =       torch.tensor([[0.00_19, 0.99_51, 0.00_30]]						)
  elif model_name == "xclip-base-patch32-16-frames":
    lowercase_     =       torch.tensor([[7.0999e-04, 9.9883e-01, 4.5580e-04]]						)
  elif model_name == "xclip-base-patch16":
    lowercase_     =       torch.tensor([[0.00_83, 0.96_81, 0.02_36]]						)
  elif model_name == "xclip-base-patch16-16-frames":
    lowercase_     =       torch.tensor([[7.6937e-04, 9.9728e-01, 1.9473e-03]]						)
  elif model_name == "xclip-large-patch14":
    lowercase_     =       torch.tensor([[0.00_62, 0.98_64, 0.00_75]]						)
  elif model_name == "xclip-large-patch14-16-frames":
    lowercase_     =       torch.tensor([[3.3877e-04, 9.9937e-01, 2.8888e-04]]						)
  # kinetics-600
  elif model_name == "xclip-base-patch16-kinetics-600":
    lowercase_     =       torch.tensor([[0.05_55, 0.89_14, 0.05_31]]						)
  elif model_name == "xclip-base-patch16-kinetics-600-16-frames":
    lowercase_     =       torch.tensor([[3.8554e-04, 9.9929e-01, 3.2754e-04]]						)
  elif model_name == "xclip-large-patch14-kinetics-600":
    lowercase_     =       torch.tensor([[0.00_36, 0.99_20, 0.00_45]]						)
  # few shot
  elif model_name == "xclip-base-patch16-hmdb-2-shot":
    lowercase_     =       torch.tensor([[7.1890e-06, 9.9994e-01, 5.6559e-05]]						)
  elif model_name == "xclip-base-patch16-hmdb-4-shot":
    lowercase_     =       torch.tensor([[1.0320e-05, 9.9993e-01, 6.2435e-05]]						)
  elif model_name == "xclip-base-patch16-hmdb-8-shot":
    lowercase_     =       torch.tensor([[4.1377e-06, 9.9990e-01, 9.8386e-05]]						)
  elif model_name == "xclip-base-patch16-hmdb-16-shot":
    lowercase_     =       torch.tensor([[4.1347e-05, 9.9962e-01, 3.3411e-04]]						)
  elif model_name == "xclip-base-patch16-ucf-2-shot":
    lowercase_     =       torch.tensor([[8.5857e-05, 9.9928e-01, 6.3291e-04]]						)
  elif model_name == "xclip-base-patch16-ucf-4-shot":
    lowercase_     =       torch.tensor([[8.5857e-05, 9.9928e-01, 6.3291e-04]]						)
  elif model_name == "xclip-base-patch16-ucf-8-shot":
    lowercase_     =       torch.tensor([[0.00_27, 0.99_04, 0.00_70]]						)
  elif model_name == "xclip-base-patch16-ucf-16-shot":
    lowercase_     =       torch.tensor([[9.8219e-04, 9.9593e-01, 3.0863e-03]]						)
  # zero shot
  elif model_name == "xclip-base-patch16-zero-shot":
    lowercase_     =       torch.tensor([[3.5082e-04, 9.9785e-01, 1.7966e-03]]						)
  else:
    raise ValueError(f"""Model name {model_name} not supported"""						)
  assert torch.allclose(SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	atol=1e-3						)
  print("""Looks ok!"""						)

  if pytorch_dump_folder_path is not None:
    print(f"""Saving model {model_name} to {pytorch_dump_folder_path}"""						)
    model.save_pretrained(SCREAMING_SNAKE_CASE_						)

  if push_to_hub:
    print("""Pushing model, processor and slow tokenizer files to the hub..."""						)
    model.push_to_hub(SCREAMING_SNAKE_CASE_ ,	organization="""nielsr"""						)
    processor.push_to_hub(SCREAMING_SNAKE_CASE_ ,	organization="""nielsr"""						)
    slow_tokenizer.push_to_hub(SCREAMING_SNAKE_CASE_ ,	organization="""nielsr"""						)


if __name__ == "__main__":
       __snake_case						  =		argparse.ArgumentParser()
       # Required parameters
       parser.add_argument(
           """--model_name""",
           default="""xclip-base-patch32""",
           type=str,
           help="""Name of the model.""",
       )
       parser.add_argument(
           """--pytorch_dump_folder_path""", default=None, type=str, help="""Path to the output PyTorch model directory."""
       )
       parser.add_argument(
           """--push_to_hub""", action="""store_true""", help="""Whether or not to push the converted model to the 🤗 hub."""
       )

       __snake_case						  =		parser.parse_args()
       convert_xclip_checkpoint(args.model_name, args.pytorch_dump_folder_path, args.push_to_hub)


'''simple docstring'''


import csv
from collections import defaultdict
from dataclasses import dataclass, field
from typing import List, Optional

import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import ScalarFormatter

from transformers import HfArgumentParser

def   A_      (       SCREAMING_SNAKE_CASE_=None ,	SCREAMING_SNAKE_CASE_=None						)			->str:
  return field(default_factory=lambda: default ,	metadata=SCREAMING_SNAKE_CASE_						)





@dataclass
class       _a    :


  """simple docstring"""

  A_    							=						field(
      metadata={'''help''': '''The csv file to plot.'''} ,				)
  A_    							=						field(
      default=__a ,				metadata={'''help''': '''Whether to plot along batch size or sequence length. Defaults to sequence length.'''} ,				)
  A_    							=						field(
      default=__a ,				metadata={'''help''': '''Whether the csv file has time results or memory results. Defaults to memory results.'''} ,				)
  A_    							=						field(
      default=__a ,				metadata={'''help''': '''Disable logarithmic scale when plotting'''} ,				)
  A_    							=						field(
      default=__a ,				metadata={
          '''help''': '''Whether the csv file has training results or inference results. Defaults to inference results.'''
      } ,				)
  A_    							=						field(
      default=__a ,				metadata={'''help''': '''Filename under which the plot will be saved. If unused no plot is saved.'''} ,				)
  A_    							=						list_field(
      default=__a ,				metadata={'''help''': '''List of model names that are used instead of the ones in the csv file.'''}      )






def   A_      (       SCREAMING_SNAKE_CASE_						)			->Dict:
  try:
    int(SCREAMING_SNAKE_CASE_						)
    return True
  except ValueError:
    return False

def   A_      (       SCREAMING_SNAKE_CASE_						)			->int:
  try:
    float(SCREAMING_SNAKE_CASE_						)
    return True
  except ValueError:
    return False





class       _a    :


  """simple docstring"""

  def __init__(		self      :       str   ,				lowercase_      :       List[str]      ):







    '''simple docstring'''


    lowercase_     =       args
    lowercase_     =       defaultdict(lambda: {"bsz": [], "seq_len": [], "result": {}}      )

    with open(self.args.csv_file   ,				newline=""""""      ) as csv_file:
      lowercase_     =       csv.DictReader(lowercase_      )
      for row in reader:
        lowercase_     =       row["""model"""]
        self.result_dict[model_name]["bsz"].append(int(row["""batch_size"""]      )      )
        self.result_dict[model_name]["seq_len"].append(int(row["""sequence_length"""]      )      )
        if can_convert_to_int(row["""result"""]      ):
          # value is not None
          lowercase_     =       int(row["""result"""]      )
        elif can_convert_to_float(row["""result"""]      ):
          # value is not None
          lowercase_     =       float(row["""result"""]      )





  def 		lowerCamelCase__  (		self      :       str      ):







    '''simple docstring'''


    lowercase_     ,	lowercase_     =       plt.subplots()
    lowercase_     =       """Time usage""" if self.args.is_time else """Memory usage"""
    lowercase_     =       title_str + """ for training""" if self.args.is_train else title_str + """ for inference"""

    if not self.args.no_log_scale:
      # set logarithm scales
      ax.set_xscale("""log"""      )
      ax.set_yscale("""log"""      )

    for axis in [ax.xaxis, ax.yaxis]:
      axis.set_major_formatter(ScalarFormatter()      )

    for model_name_idx, model_name in enumerate(self.result_dict.keys()      ):
      lowercase_     =       sorted(set(self.result_dict[model_name]["""bsz"""]      )      )
      lowercase_     =       sorted(set(self.result_dict[model_name]["""seq_len"""]      )      )
      lowercase_     =       self.result_dict[model_name]["""result"""]

      ((lowercase_)     ,	(lowercase_))     =       (
          (batch_sizes, sequence_lengths) if self.args.plot_along_batch else (sequence_lengths, batch_sizes)
      )

      lowercase_     =       (
          model_name if self.args.short_model_names is None else self.args.short_model_names[model_name_idx]
      )

      for inner_loop_value in inner_loop_array:
        if self.args.plot_along_batch:
          lowercase_     =       np.asarray(
              [results[(x, inner_loop_value)] for x in x_axis_array if (x, inner_loop_value) in results]   ,				dtype=lowercase_   ,				)
        else:
          lowercase_     =       np.asarray(
              [results[(inner_loop_value, x)] for x in x_axis_array if (inner_loop_value, x) in results]   ,				dtype=np.floataa   ,				)

        ((lowercase_)     ,	(lowercase_))     =       (
            ("""batch_size""", """len""") if self.args.plot_along_batch else ("""in #tokens""", """bsz""")
        )

        lowercase_     =       np.asarray(lowercase_   ,				lowercase_      )[: len(lowercase_      )]
        plt.scatter(
            lowercase_   ,				lowercase_   ,				label=F"""{label_model_name} - {inner_loop_label}: {inner_loop_value}"""      )
        plt.plot(lowercase_   ,				lowercase_   ,				"""--"""      )

      title_str += F""" {label_model_name} vs."""

    lowercase_     =       title_str[:-4]
    lowercase_     =       """Time in s""" if self.args.is_time else """Memory in MB"""

    # plot
    plt.title(lowercase_      )
    plt.xlabel(lowercase_      )
    plt.ylabel(lowercase_      )
    plt.legend()

    if self.args.figure_png_file is not None:
      plt.savefig(self.args.figure_png_file      )
    else:
      plt.show()






def   A_      (       )			->Tuple:
  lowercase_     =       HfArgumentParser(SCREAMING_SNAKE_CASE_						)
  lowercase_     =       parser.parse_args_into_dataclasses()[0]
  lowercase_     =       Plot(args=SCREAMING_SNAKE_CASE_						)
  plot.plot()


if __name__ == "__main__":
       main()

