code: def main():
      # read input arguments
      # currently designed arguments
      parser = argparse.ArgumentParser(
          description="Benchmarking Parameters"
      )
      parser.add_argument(
          "-m",
          "--model",
          type=str,
          default="tcn",
          metavar="",
          help=(
              "model name, choose from tcn/lstm/seq2seq/nbeats/autoformer,"
              ' default to "tcn".'
          ),
      )
      parser.add_argument(
          "-s",
          "--stage",
          type=str,
          default="train",
          metavar="",
          help=(
              "stage name, choose from train/latency/throughput/accuracy,"
              ' default to "train".'
          ),
      )
      parser.add_argument(
          "-d",
          "--dataset",
          type=str,
          default="tsinghua_electricity",
          metavar="",
          help=(
              "dataset name, choose from nyc_taxi/tsinghua_electricity/"
              'synthetic_dataset, default to "tsinghua_electricity".'
          ),
      )
      parser.add_argument(
          "-f",
          "--framework",
          type=str,
          default="torch",
          metavar="",
          help='framework name, choose from torch/tensorflow, default to "torch".',
      )
      parser.add_argument(
          "-c",
          "--cores",
          type=int,
          default=0,
          metavar="",
          help="core number, default to all physical cores.",
      )
      parser.add_argument(
          "-l",
          "--lookback",
          type=int,
          metavar="lookback",
          required=True,
          help="required, the history time steps (i.e. lookback).",
      )
      parser.add_argument(
          "-o",
          "--horizon",
          type=int,
          metavar="horizon",
          required=True,
          help="required, the output time steps (i.e. horizon).",
      )
  
      # useful arguments which are not concluded in the currently designed pattern.
      parser.add_argument(
          "--training_processes",
          type=int,
          default=1,
          metavar="",
          help="number of processes when training, default to 1.",
      )
      parser.add_argument(
          "--training_batchsize",
          type=int,
          default=32,
          metavar="",
          help="batch size when training, default to 32.",
      )
      parser.add_argument(
          "--training_epochs",
          type=int,
          default=1,
          metavar="",
          help="number of epochs when training, default to 1.",
      )
      parser.add_argument(
          "--inference_batchsize",
          type=int,
          default=1,
          metavar="",
          help="batch size when infering, default to 1.",
      )
      parser.add_argument(
          "--quantize",
          action="store_true",
          help="if use the quantized model to predict, default to False."
          "tensorflow will support quantize later.",
      )
      parser.add_argument(
          "--inference_framework",
          nargs="+",
          default=["torch"],
          metavar="",
          help=(
              "predict without/with accelerator, choose from torch/onnx/openvino"
              '/jit, default to "torch" (i.e. predict without accelerator).'
          ),
      )
      parser.add_argument(
          "--ipex",
          action="store_true",
          help="if use ipex as accelerator for trainer, default to False.",
      )
      parser.add_argument(
          "--quantize_type",
          type=str,
          default="pytorch_fx",
          metavar="",
          help=(
              "quantize framework, choose from pytorch_fx/pytorch_ipex/"
              'onnxrt_qlinearops/openvino, default to "pytorch_fx".'
          ),
      )
      parser.add_argument(
          "--ckpt",
          type=str,
          default="checkpoints/tcn",
          metavar="",
          help=(
              'checkpoint path of a trained model, e.g. "checkpoints/tcn",'
              ' default to "checkpoints/tcn".'
          ),
      )
      parser.add_argument(
          "--metrics",
          type=str,
          nargs="+",
          default=["mse", "mae"],
          metavar="",
          help=(
              'evaluation metrics of a trained model, e.g. "mse"/"mae",'
              ' default to "mse, mae".'
          ),
      )
      parser.add_argument(
          "--normalization",
          action="store_true",
          help="if to use normalization trick to alleviate distribution shift.",
      )
      args = parser.parse_args()
      records = vars(args)
  
      # anomaly detection for input arguments
      models = ["tcn", "lstm", "seq2seq", "nbeats", "autoformer"]
      stages = ["train", "latency", "throughput", "accuracy"]
      datasets = [
          "tsinghua_electricity",
          "nyc_taxi",
          "synthetic_dataset",
      ]
      frameworks = ["torch", "tensorflow"]
      quantize_types = [
          "pytorch_fx",
          "pytorch_ipex",
          "onnxrt_qlinearops",
          "openvino",
      ]
      quantize_torch_types = ["pytorch_fx", "pytorch_ipex"]
      invalidInputError(
          args.model in models,
          f"-m/--model argument should be one of {models}, but get '{args.model}'",
      )
      invalidInputError(
          args.stage in stages,
          f"-s/--stage argument should be one of {stages}, but get '{args.stage}'",
      )
      invalidInputError(
          args.dataset in datasets,
          (
              f"-d/--dataset argument should be one of {datasets},"
              " but get '{args.dataset}'"
          ),
      )
      invalidInputError(
          args.framework in frameworks,
          (
              f"-f/--framework argument should be one of {frameworks},"
              " but get '{args.framework}'"
          ),
      )
      invalidInputError(
          args.quantize_type in quantize_types,
          (
              f"--quantize_type argument should be one of {quantize_types},"
              " but get '{args.quantize_type}'"
          ),
      )
      if args.quantize and "torch" in args.inference_framework:
          invalidInputError(
              args.quantize_type in quantize_torch_types,
              (
                  f"if inference framework is 'torch', then --quantize_type"
                  " argument should be one of {quantize_torch_types},"
                  " but get '{args.quantize_type}'"
              ),
          )
  
      if "onnx" in args.inference_framework:
          args.quantize_type = "onnxrt_qlinearops"
      elif "openvino" in args.inference_framework:
          args.quantize_type = "openvino"
  
      # implement thread control according to parameter `cores`
      if args.framework == "torch":
          import torch
  
          if args.cores:
              torch.set_num_threads(args.cores)
          experiment(args, records)
      else:
          if args.cores:
              new_experiment = spawn_new_process(experiment)
              new_experiment(
                  args,
                  records,
                  env_var={"OMP_NUM_THREADS": str(args.cores)},
              )
          else:
              experiment(args, records)
  
file_path: BigDL/python/chronos/src/bigdl/chronos/benchmark/benchmark_chronos.py
imports: from bigdl.chronos.benchmark import generate_forecaster, generate_data, get_CPU_info, check_nano_env
  import time
  import numpy
  import argparse
  import os
  from scipy import stats
  import psutil
  import subprocess
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.utils.common import spawn_new_process
label_desc: Use image node_id 7 for calling a global function with example usage: main() without return types