code: def test_plot_results():
      import pandas as pd
      import json
  
      res = []
      with open(results_file) as f:
          for line in f.readlines():
              entry = json.loads(line)
              res.append(entry)
      X = pd.DataFrame(res)
      X.to_csv(results_file + ".csv", index=False)
  
      result_cols = [
          "summarization time [sec]",
          "generation speed [tokens/sec]",
      ]
      X[result_cols[0]] = X["summarize_time"]
      X[result_cols[1]] = (
          X["generate_output_len_bytes"] / 4 / X["generate_time"]
      )
      with open(results_file.replace(".json", ".md"), "w") as f:
          for backend in pd.unique(X["backend"]):
              print("# Backend: %s" % backend, file=f)
              for base_model in pd.unique(X["base_model"]):
                  print(
                      "## Model: %s (%s)" % (base_model, backend),
                      file=f,
                  )
                  for n_gpus in sorted(pd.unique(X["n_gpus"])):
                      XX = X[
                          (X["base_model"] == base_model)
                          & (X["backend"] == backend)
                          & (X["n_gpus"] == n_gpus)
                      ]
                      if XX.shape[0] == 0:
                          continue
                      print("### Number of GPUs: %s" % n_gpus, file=f)
                      XX.drop_duplicates(
                          subset=["bits", "gpus"],
                          keep="last",
                          inplace=True,
                      )
                      XX = XX.sort_values(
                          ["bits", result_cols[1]],
                          ascending=[False, False],
                      )
                      XX["exception"] = (
                          XX["exception"].astype(str).replace("nan", "")
                      )
                      print(
                          XX[
                              [
                                  "bits",
                                  "gpus",
                                  result_cols[0],
                                  result_cols[1],
                                  "exception",
                              ]
                          ].to_markdown(index=False),
                          file=f,
                      )
  
file_path: h2ogpt/tests/test_perf_benchmarks.py
imports: import ast
  import os
  import subprocess
  import time
  import pytest
  from tests.test_inference_servers import run_h2ogpt_docker
  from tests.utils import wrap_test_forked, get_inf_server, get_inf_port
  from src.utils import download_simple
label_desc: Use image node_id 2 for calling a global function with example usage: test_plot_results() without return types