code: def get_metrics(config, y_true=None, y_pred=None):
      """candies function of metrics
      calc metrics through `y_true` and `y_pred` or
      `confusion` will be deprecated
      """
      metrics = config["solver"]["metrics"]
      if isinstance(metrics, list):  # metrics for multi-outputs
          if len(y_true) != len(y_pred) or len(metrics) != len(y_true):
              raise ValueError(
                  "Length of y_true, y_pred and metrics must be equal!"
              )
          score = []
          for i, metrics_one_output in enumerate(metrics):
              score.append(
                  run_metrics_for_one_output(
                      metrics_one_output, y_true[i], y_pred[i]
                  )
              )
      else:
          score = run_metrics_for_one_output(metrics, y_true, y_pred)
      return score
  
imports: import os
  import abc
  from absl import logging
  import numpy
  from sklearn import metrics
  from seqeval.metrics import classification_report
  from delta.utils.register import registers
  from delta.utils.postprocess.postprocess_utils import ids_to_sentences
  from rouge import FilesRouge
  from sacrebleu import corpus_bleu
  from delta.utils.metrics import metric_utils
label_desc: Use image node_id 2 for calling a global function with example usage: get_metrics(config, y_true, y_pred) and returns: score