code: def benchmark(
      model,
      input_data,
      device=None,
      random=False,
      n_warmup=50,
      n_runs=1000,
  ):
      """Performs a Benchmark on the input model regardless of the framework it
      was used for implementing it.
      Args:
          model (Any): The input model.
          input_data (Iterable or Sequence): Input data to be used for
              optimizing the model. PyTorch, TensorFlow
              and Onnx respectively accept input tensor in `torch.Tensor`,
              `tf.Tensor` and `np.ndarray` formats. Note that the each input
              sample must be a tuple containing a tuple as first element, the
              `inputs`, and the `label` as second element. The `inputs` needs to
              be passed as tuple even if a single input is needed by the model
              (in this case the `inputs` tuple will contain just an element).
              HuggingFace models can take as data samples both dictionaries or
              strings. Strings will then be converted in data samples using the
              HuggingFace tokenizer which must be given as input when just a
              list of string is provided as input_data (tokenizers can be passed
              as extra arguments of this function using the keyword `tokenizer`).
          device (str): Device to be used for running the benchmark. If None,
              CPU will be used. Default: None.
          random (bool, optional): If set to true, the data used to benchmark the
              model will be computed randomly given the info extracted from the
              provided input_data.
          n_warmup (int, optional): Number of warmup iterations.
          n_runs (int, optional): Number of iterations performed to benchmark
              the model.
      """
      if not isinstance(model, BaseInferenceLearner):
          device = check_device(device)
      else:
          device = model.device
  
      logger.info(f"Running benchmark on {device.type.name}")
  
      dl_framework = _get_dl_framework(model)
  
      if isinstance(input_data, (DataLoader, tf.data.Dataset)):
          try:
              input_data = DataManager.from_dataloader(input_data)
          except Exception:
              raise ValueError(
                  "The provided dataloader does not match the expected "
                  "format.\n"
                  "Speedster supports dataloaders that return tuples in "
                  "the\n"
                  "following formats: \n"
                  "Single input: (input,  label)\n"
                  "Multiple inputs: ((input1, input2, ...),  label) or "
                  "(input1, input2, ...,  label)\n"
                  "Inputs and labels should be either tensors or numpy "
                  "arrays,\n"
                  "depending on the framework used.\n"
              )
  
      if not isinstance(input_data, DataManager):
          if check_input_data(input_data):
              if is_data_subscriptable(input_data):
                  input_data = DataManager(input_data)
              else:
                  input_data = DataManager.from_iterable(input_data)
          else:
              raise ValueError(
                  "The provided data does not match the expected "
                  "format.\n"
                  "Speedster supports data in the following formats: \n"
                  "- PyTorch DataLoader\n"
                  "- TensorFlow Dataset\n"
                  "- List of tuples: [((input_0, ... ), label), ...] \n"
                  "Inputs and labels should be either tensors or numpy "
                  "arrays,\n"
                  "depending on the framework used.\n"
              )
  
      if random:
          model_params = extract_info_from_data(
              model, input_data, dl_framework, None, device
          )
          input_data = _create_model_inputs(dl_framework, model_params)
      else:
          input_data = input_data.get_list()
  
      BENCHMARK_FUNCTIONS[dl_framework](
          model=model,
          input_tensors=input_data,
          device=device,
          n_warmup=n_warmup,
          n_runs=n_runs,
      ).benchmark()
  
imports: import time
  from abc import abstractmethod, ABC
  from typing import Any, Dict, Type
  import numpy
  from loguru import logger
  from tqdm import tqdm
  from nebullvm.core.models import DeepLearningFramework, ModelParams, DeviceType
  from nebullvm.operations.inference_learners.base import BaseInferenceLearner
  from nebullvm.optional_modules.tensorflow import tensorflow
  from nebullvm.optional_modules.torch import torch, DataLoader
  from nebullvm.tools.data import DataManager
  from nebullvm.tools.onnx import create_model_inputs_onnx
  from nebullvm.tools.pytorch import create_model_inputs_torch
  from nebullvm.tools.tf import create_model_inputs_tf
  from nebullvm.tools.utils import check_input_data, extract_info_from_data, is_data_subscriptable, check_device
label_desc: Use image node_id 3 for calling a global function with example usage: benchmark(model, input_data, device, random, n_warmup, n_runs) without return types