code: def default_compute_objective(metrics: Dict[str, float]) -> float:
      """
      The default objective to maximize/minimize when doing an hyperparameter search. It is the evaluation loss if no
      metrics are provided to the [`Trainer`], the sum of all metrics otherwise.
  
      Args:
          metrics (`Dict[str, float]`): The metrics returned by the evaluate method.
  
      Return:
          `float`: The objective to minimize or maximize
      """
      metrics = copy.deepcopy(metrics)
      loss = metrics.pop("eval_loss", None)
      _ = metrics.pop("epoch", None)
      # Remove speed metrics
      speed_metrics = [
          m
          for m in metrics.keys()
          if m.endswith("_runtime")
          or m.endswith("_per_second")
          or m.endswith("_compilation_time")
      ]
      for sm in speed_metrics:
          _ = metrics.pop(sm, None)
      return loss if len(metrics) == 0 else sum(metrics.values())
  
imports: import copy
  import functools
  import gc
  import inspect
  import os
  import random
  import re
  import threading
  import time
  from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union
  import numpy
  from .utils import ExplicitEnum, is_psutil_available, is_tf_available, is_torch_available, is_torch_cuda_available, is_torch_mps_available, is_torch_npu_available, is_torch_tpu_available, is_torch_xpu_available, requires_backends
label_desc: Use image node_id 6 for calling a global function with example usage: default_compute_objective(metrics) and returns: unknown