code: def benchmark_single(
      batch_size,
      gpu,
      max_seq_len,
      doc_stride,
      document_size,
      question,
      modelname,
  ):
      try:
          input_dict = prepare_dict(
              sample_file, question, document_size
          )
  
          # Run once with dummy prediction heads
          inferencer_dummy_ph = Inferencer.load(
              modelname,
              batch_size=batch_size,
              gpu=gpu,
              task_type=task_type,
              max_seq_len=max_seq_len,
              num_processes=num_processes,
              doc_stride=doc_stride,
              dummy_ph=True,
              benchmarking=True,
          )
          inferencer_dummy_ph.inference_from_dicts(input_dict)
          (
              preproc_lm_only,
              model_lm_only,
          ) = inferencer_dummy_ph.benchmarker.summary()
  
          # Run once with real prediction heads
          inferencer_real_ph = Inferencer.load(
              modelname,
              batch_size=batch_size,
              gpu=gpu,
              task_type=task_type,
              max_seq_len=max_seq_len,
              num_processes=num_processes,
              doc_stride=doc_stride,
              dummy_ph=False,
              benchmarking=True,
          )
          inferencer_real_ph.inference_from_dicts(input_dict)
          (
              preproc_full,
              model_full,
          ) = inferencer_real_ph.benchmarker.summary()
  
          ave_preproc, lm_time, ph_time, total = analyse_timing(
              preproc_lm_only, model_lm_only, preproc_full, model_full
          )
          result = {
              "model name": modelname,
              "question": question,
              "preproc": ave_preproc,
              "language model": lm_time,
              "prediction head": ph_time,
              "total": total,
              "passages per sec": (document_size * passages_per_char)
              / total,
              "batch_size": batch_size,
              "document_size": document_size,
              "num_processes": num_processes,
              "max_seq_len": max_seq_len,
              "doc_stride": doc_stride,
              "gpu": gpu,
              "sample_file": sample_file,
              "error": "",
          }
          del inferencer_dummy_ph
          del inferencer_real_ph
      except Exception as e:
          result = {
              "model name": modelname,
              "question": question,
              "preproc": -1,
              "language model": -1,
              "prediction head": -1,
              "total": -1,
              "passages_per_sec": -1,
              "batch_size": batch_size,
              "document_size": document_size,
              "num_processes": num_processes,
              "max_seq_len": max_seq_len,
              "doc_stride": doc_stride,
              "gpu": gpu,
              "sample_file": sample_file,
              "error": str(e),
          }
      return result
  
file_path: FARM/test/benchmarks/question_answering_components.py
imports: from farm.infer import Inferencer
  from pprint import pformat
  import pandas
  from tqdm import tqdm
  import logging
  import json
  from datetime import date
label_desc: Use image node_id 3 for calling a global function with example usage: benchmark_single(batch_size, gpu, max_seq_len, doc_stride, document_size, question, modelname) and returns: result