code: def test_custom_metric():
      dataset = HatefulMeMesDataset()
      metric_name = dataset.metric
      custom_metric_name = "customized"
      metric_scorer = ag_metrics.get_metric(metric_name)
      metric_scorer.name = custom_metric_name
      predictor_by_name = MultiModalPredictor(
          label=dataset.label_columns[0],
          problem_type=dataset.problem_type,
          eval_metric=metric_name,
      )
      predictor_by_scorer = MultiModalPredictor(
          label=dataset.label_columns[0],
          problem_type=dataset.problem_type,
          eval_metric=metric_scorer,
      )
      with tempfile.TemporaryDirectory() as save_path:
          if os.path.isdir(save_path):
              shutil.rmtree(save_path)
          predictor_by_name.fit(
              train_data=dataset.train_df,
              time_limit=0,
              save_path=save_path,
          )
      with tempfile.TemporaryDirectory() as save_path:
          if os.path.isdir(save_path):
              shutil.rmtree(save_path)
          predictor_by_scorer.fit(
              train_data=dataset.train_df,
              time_limit=0,
              save_path=save_path,
          )
      scores_by_name = predictor_by_name.evaluate(
          data=dataset.test_df,
          metrics=None,
      )
      scores_by_scorer_eval = predictor_by_name.evaluate(
          data=dataset.test_df,
          metrics=[metric_scorer],
      )
      scores_by_scorer_init = predictor_by_scorer.evaluate(
          data=dataset.test_df,
          metrics=None,
      )
      assert (
          scores_by_scorer_eval[custom_metric_name]
          == scores_by_scorer_init[custom_metric_name]
      )
      assert (
          scores_by_name[metric_name]
          == scores_by_scorer_eval[custom_metric_name]
      )
  
imports: import os
  import random
  import shutil
  import tempfile
  import pytest
  import torch
  from sklearn.metrics import f1_score, log_loss
  from torchmetrics import MeanMetric, RetrievalHitRate
  import autogluon.core.metrics
  from autogluon.multimodal import MultiModalPredictor
  from autogluon.multimodal.constants import MULTICLASS, Y_PRED, Y_TRUE
  from autogluon.multimodal.optimization.utils import compute_hit_rate, get_loss_func, get_metric
  from autogluon.multimodal.utils import compute_score, infer_metrics
  from ..utils.unittest_datasets import HatefulMeMesDataset, PetFinderDataset
  from ..utils.utils import get_home_dir
label_desc: Use image node_id 8 for calling a global function with example usage: test_custom_metric() without return types