class_docstr: Benchmarks is a simple but feature-complete benchmarking script
  to compare memory and time performance of models in Transformers.
docstr: Parameters
  ----------
  workloads
      List of workloads to profile
  model_names
      List of model names to profile
  use_fp16
      Whether to use fp16
  repeat
      The number of repeat
  use_gpu
      Whether to use GPU
  device_idx
      The GPU ID
  profile_inference
      Whether to profile inference
  profile_train
      Whether to profile training
  env_print
      Whether to print the environment
  to_csv
      Whether to dump to csv file
  use_tvm
      Whether to use TVM to accelerate the
  instance_type
      Type of the instance. This will only be used to set the
  layout
      The input + output layout
  compute_layout
      The computation layout
  inference_out_csv_file
  train_out_csv_file
  env_info_file
docstr_tok: ["Parameters","--","--","--","--","--","workloads","List","of","workloads","to","profile","model_names","List","of","model","names","to","profile","use_fp16","Whether","to","use","fp16","repeat","The","number","of","repeat","use_gpu","Whether","to","use","GPU","device_idx","The","GPU","ID","profile_inference","Whether","to","profile","inference","profile_train","Whether","to","profile","training","env_print","Whether","to","print","the","environment","to_csv","Whether","to","dump","to","csv","file","use_tvm","Whether","to","use","TVM","to","accelerate","the","instance_type","Type","of","the","instance",".","This","will","only","be","used","to","set","the","layout","The","input","+","output","layout","compute_layout","The","computation","layout","inference_out_csv_file","train_out_csv_file","env_info_file"]
code: def __init__(
      self,
      workloads,
      model_names,
      use_fp16=False,
      repeat=3,
      use_gpu=True,
      device_idx=0,
      profile_inference=True,
      profile_train=True,
      env_print=True,
      to_csv=False,
      use_tvm=False,
      instance_type=None,
      layout="NT",
      compute_layout="auto",
      inference_out_csv_file="inference_time_memory.csv",
      train_out_csv_file="train_time_memory.csv",
      env_info_file="env_info.csv",
  ):
      """
  
      Parameters
      ----------
      workloads
          List of workloads to profile
      model_names
          List of model names to profile
      use_fp16
          Whether to use fp16
      repeat
          The number of repeat
      use_gpu
          Whether to use GPU
      device_idx
          The GPU ID
      profile_inference
          Whether to profile inference
      profile_train
          Whether to profile training
      env_print
          Whether to print the environment
      to_csv
          Whether to dump to csv file
      use_tvm
          Whether to use TVM to accelerate the
      instance_type
          Type of the instance. This will only be used to set the
      layout
          The input + output layout
      compute_layout
          The computation layout
      inference_out_csv_file
      train_out_csv_file
      env_info_file
      """
      self._workloads = workloads
      if not isinstance(workloads, list):
          workloads = [workloads]
      if not isinstance(model_names, (list, tuple)):
          model_names = [model_names]
      self._workloads = workloads
      self._model_names = model_names
      self._use_fp16 = use_fp16
      self._repeat = repeat
      self._use_gpu = use_gpu
      self._device_idx = device_idx
      self._environment_info = None
      self._profile_inference = profile_inference
      self._profile_train = profile_train
      self._env_print = env_print
      self._to_csv = to_csv
      self._use_tvm = use_tvm
      self._instance_type = instance_type
      self._layout = layout
      self._compute_layout = compute_layout
      self._inference_out_csv_file = inference_out_csv_file
      self._train_out_csv_file = train_out_csv_file
      self._env_info_file = env_info_file
  
imports: import copy
  import csv
  import linecache
  import logging
  import os
  import platform
  import sys
  import timeit
  import numpy
  import gluonnlp
  from gluonnlp.models import get_backbone
  from gluonnlp.utils.misc import logging_config
  from gluonnlp.utils.lazy_imports import try_import_tvm
  from collections import defaultdict, namedtuple
  from datetime import datetime
  import multiprocessing
  from multiprocessing import Pipe, Process, Queue
  from multiprocessing.connection import Connection
  from typing import Callable, Iterable, List, NamedTuple, Optional, Union, Tuple
label_desc: Use image node_id 1 to create a new GluonNLPBackboneBenchmark object  with example: obj = GluonNLPBackboneBenchmark(workloads, model_names, use_fp16, repeat, use_gpu, device_idx, profile_inference, profile_train, env_print, to_csv, use_tvm, instance_type, layout, compute_layout, inference_out_csv_file, train_out_csv_file, env_info_file)