code: def get_metadata(
      task: TaskType, transform: dict[str, Any], model: AnomalyModule
  ) -> dict[str, Any]:
      """Get metadata for the exported model.
  
      Args:
          task (TaskType): Task type.
          transform (dict[str, Any]): Transform used for the model.
          model (AnomalyModule): Model to export.
          export_mode (ExportMode): Mode to export the model. Torch, ONNX or OpenVINO.
  
      Returns:
          dict[str, Any]: Metadata for the exported model.
      """
      data_metadata = {"task": task, "transform": transform}
      model_metadata = get_model_metadata(model)
      metadata = {**data_metadata, **model_metadata}
  
      # Convert torch tensors to python lists or values for json serialization.
      for key, value in metadata.items():
          if isinstance(value, Tensor):
              metadata[key] = value.numpy().tolist()
  
      return metadata
  
imports: from __future__ import annotations
  import json
  import logging
  import subprocess
  from enum import Enum
  from importlib.util import find_spec
  from pathlib import Path
  from typing import Any
  from warnings import warn
  import numpy
  import torch
  from torch import Tensor
  from torch.types import Number
  from anomalib.data.task_type import TaskType
  from anomalib.models.components import AnomalyModule
label_desc: Use image node_id 2 for calling a global function with example usage: get_metadata(task, transform, model) and returns: metadata