docstr: Run evaluation and returns metrics and predictions.
  
  Args:
      dataset (`datasets.Dataset`):
          Dataset to use for the evaluation step.
code: def evaluation_loop(self, dataset: Dataset):
      """
      Run evaluation and returns metrics and predictions.
  
      Args:
          dataset (`datasets.Dataset`):
              Dataset to use for the evaluation step.
      """
      logger.info("***** Running evaluation *****")
      all_preds = None
      all_labels = None
      for step, inputs in enumerate(dataset):
          has_labels = all(
              inputs.get(k) is not None for k in self.label_names
          )
          if has_labels:
              labels = tuple(
                  np.array([inputs.get(name)])
                  for name in self.label_names
              )
              if len(labels) == 1:
                  labels = labels[0]
          else:
              labels = None
          onnx_inputs = {
              key: np.array([inputs[key]])
              for key in self.onnx_input_names
              if key in inputs
          }
          preds = self.session.run(None, onnx_inputs)
          if len(preds) == 1:
              preds = preds[0]
          all_preds = (
              preds
              if all_preds is None
              else nested_concat(all_preds, preds, padding_index=-100)
          )
          all_labels = (
              labels
              if all_labels is None
              else nested_concat(all_labels, labels, padding_index=-100)
          )
      if (
          self.compute_metrics is not None
          and all_preds is not None
          and all_labels is not None
      ):
          metrics = self.compute_metrics(
              EvalPrediction(
                  predictions=all_preds, label_ids=all_labels
              )
          )
      else:
          metrics = {}
      return EvalLoopOutput(
          predictions=all_preds,
          label_ids=all_labels,
          metrics=metrics,
          num_samples=len(dataset),
      )
  
file_path: optimum/optimum/onnxruntime/model.py
imports: import logging
  import os
  from typing import Callable, Dict, List, Optional, Union
  import numpy
  from datasets import Dataset
  from transformers import EvalPrediction
  from transformers.trainer_pt_utils import nested_concat
  from transformers.trainer_utils import EvalLoopOutput
  from onnxruntime import InferenceSession
label_desc: Use image node_id 2 for calling the ORTModel obj's underlying member method code with example usage: obj.evaluation_loop(dataset) and returns: EvalLoopOutput