code: def dump_metrics(cfg, metrics):
      """Simple yaml dump of metric values."""
  
      filepath = f"metrics_{cfg.name}.yaml"
      sanitized_metrics = dict()
      for metric, val in metrics.items():
          try:
              sanitized_metrics[metric] = np.asarray(val).item()
          except ValueError:
              sanitized_metrics[metric] = np.asarray(val).tolist()
      with open(filepath, "w") as yaml_file:
          yaml.dump(
              sanitized_metrics, yaml_file, default_flow_style=False
          )
  
imports: import socket
  import sys
  import os
  import csv
  import yaml
  import psutil
  import pynvml
  import multiprocess
  import collections
  import torch
  import torch._inductor.config
  import transformers
  import json
  import random
  import numpy
  import time
  import datetime
  import tempfile
  from .data.utils import checksum_config
  import logging
  import hydra
  from omegaconf import OmegaConf, open_dict
label_desc: Use image node_id 12 for calling a global function with example usage: dump_metrics(cfg, metrics) without return types