code: def main():
      parser = argparse.ArgumentParser()
  
      parser.add_argument(
          "--input_path",
          type=str,
          default="../../../h2o_hf/data/xsum_opt.jsonl",
      )
      parser.add_argument("--output_path", type=str, default="output")
  
      parser.add_argument("--model_name", type=str, required=True)
      parser.add_argument(
          "--cache_dir", type=str, default="../../checkpoint/"
      )
  
      parser.add_argument("--hh_ratio", type=float, default=0.1)
      parser.add_argument("--gbs", type=int, required=True)
      parser.add_argument("--num_gb", type=int, required=True)
      parser.add_argument(
          "--percent", nargs="+", type=int, required=True
      )
  
      parser.add_argument("--sample_num", type=int, default=1000)
  
      parser.add_argument(
          "--seed",
          type=int,
          default=42,
          help="random seed for initialization",
      )
      args = parser.parse_args()
  
      args.device = torch.device("cuda")
      args.n_gpu = 1
  
      set_seed(args)
  
      model_name = args.model_name
      input_path = args.input_path
      output_path = args.output_path
  
      # load requests
      requests = []
      with open(input_path, "r") as f:
          for line in f:
              if line.strip() != "":
                  requests.append(json.loads(line))
      print("number of requests", len(requests))
      if args.sample_num < len(requests):
          print("Sample {} Examples".format(args.sample_num))
      requests = requests[: args.sample_num]
      # requests = sorted(requests, key=lambda x: len(x["request"]["prompt"]))
      # print([len(req["request"]["prompt"]) for req in requests])
  
      # run inference
      total_time, throughput = run_inference(
          model_name,
          requests,
          args.hh_ratio,
          args.gbs,
          args.num_gb,
          args.percent,
      )
      with open(output_path, "w") as f:
          res = {
              "total time": total_time,
              "generation throughput": throughput,
          }
          json.dump(res, f)
  
file_path: H2O/h2o_flexgen/benchmark/xsum/run_xsum_h2o.py
imports: import argparse
  import numpy
  import torch
  import json
  import time
  from tqdm import tqdm
  import copy
  from flexgen.flex_opt import Policy, OptLM, ExecutionEnv, CompressionConfig
  from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig
label_desc: Use image node_id 6 for calling a global function with example usage: main() without return types