code: def benchmark_eval(args):
      cfg = setup(args)
      if args.config_file.endswith(".yaml"):
          model = build_model(cfg)
          DetectionCheckpointer(model).load(cfg.MODEL.WEIGHTS)
  
          cfg.defrost()
          cfg.DATALOADER.NUM_WORKERS = 0
          data_loader = build_detection_test_loader(
              cfg, cfg.DATASETS.TEST[0]
          )
      else:
          model = instantiate(cfg.model)
          model.to(cfg.train.device)
          DetectionCheckpointer(model).load(cfg.train.init_checkpoint)
  
          cfg.dataloader.num_workers = 0
          data_loader = instantiate(cfg.dataloader.test)
  
      model.eval()
      logger.info("Model:\n{}".format(model))
      dummy_data = DatasetFromList(
          list(itertools.islice(data_loader, 100)), copy=False
      )
  
      def f():
          while True:
              yield from dummy_data
  
      for k in range(5):  # warmup
          model(dummy_data[k])
  
      max_iter = 300
      timer = Timer()
      with tqdm.tqdm(total=max_iter) as pbar:
          for idx, d in enumerate(f()):
              if idx == max_iter:
                  break
              model(d)
              pbar.update()
      logger.info(
          "{} iters in {} seconds.".format(max_iter, timer.seconds())
      )
  
imports: import itertools
  import logging
  import psutil
  import torch
  import tqdm
  from fvcore.common.timer import Timer
  from torch.nn.parallel import DistributedDataParallel
  from detectron2.checkpoint import DetectionCheckpointer
  from detectron2.config import LazyConfig, get_cfg, instantiate
  from detectron2.data import DatasetFromList, build_detection_test_loader, build_detection_train_loader
  from detectron2.data.benchmark import DataLoaderBenchmark
  from detectron2.engine import AMPTrainer, SimpleTrainer, default_argument_parser, hooks, launch
  from detectron2.modeling import build_model
  from detectron2.solver import build_optimizer
  from detectron2.utils import comm
  from detectron2.utils.collect_env import collect_env_info
  from detectron2.utils.events import CommonMetricPrinter
  from detectron2.utils.logger import setup_logger
label_desc: Use image node_id 7 for calling a global function with example usage: benchmark_eval(args) without return types