code: def output_charts(model_size, tps, bs, prompt, gen, log_dir, out_dir):
      if not log_dir.exists():
          print(f"Log directory {log_dir} does not exist")
          return
  
      if not out_dir.exists():
          out_dir.mkdir(parents=True, exist_ok=True)
  
      # Plotting the scatter plot
      plt.figure(figsize=(6, 4))
  
      colors = ["orange", "green", "brown"]
  
      for tp, color in zip(tps, colors):
          mii_file_pattern = f"{log_dir}/logs.llama2-{model_size}-tp{tp}-b{bs}/llama2-{model_size}-tp{tp}-b{bs}_c*_p{prompt}_g{gen}.json"
          _, mii_throughputs, mii_latencies = extract_values(
              mii_file_pattern
          )
  
          if len(mii_throughputs) == 0:
              continue
  
          n_params = int(model_size[:-1])
          tflops_per_query = n_params * (prompt + gen) * 2 * 1e-3
          mii_tflops = [
              th * tflops_per_query / tp for th in mii_throughputs
          ]
  
          plt.scatter(
              mii_tflops,
              mii_latencies,
              label=f"TP={tp}",
              marker="o",
              color=color,
          )
          fit_mii_x_list = np.arange(
              min(mii_tflops), max(mii_tflops), 0.01
          )
          mii_fit_model = np.polyfit(mii_tflops, mii_latencies, 3)
          mii_model_fn = np.poly1d(mii_fit_model)
          plt.plot(
              fit_mii_x_list,
              mii_model_fn(fit_mii_x_list),
              color=color,
              alpha=0.5,
              linestyle="--",
          )
  
      plt.title(
          f"Model Llama 2 {model_size.upper()}, Prompt: {prompt}, Generation: {gen}, TP: {tps}"
      )
      plt.xlabel("TFLOPs (per GPU)", fontsize=14)
      plt.ylabel("Latency", fontsize=14)
      plt.legend()
      plt.grid(True)
      # plt.show()
      out_file = (
          out_dir
          / f"tp_sizes_llama{model_size}_tp{'_'.join([str(tp) for tp in tps])}_p{prompt}g{gen}.png"
      )
      plt.savefig(out_file)
  
file_path: deepspeedexamples/benchmarks/inference/mii/plot_tp_sizes.py
imports: import glob
  import matplotlib.pyplot
  import argparse
  from pathlib import Path
  import numpy
  from postprocess_results import read_json, get_summary
label_desc: Use image node_id 3 for calling a global function with example usage: output_charts(model_size, tps, bs, prompt, gen, log_dir, out_dir) without return types