code: def test_image_text_semantic_search():
      dataset_name = "flickr30k"
      dataset = ALL_DATASETS[dataset_name]()
      image_list = dataset.test_df["image"].tolist()
      text_list = dataset.test_df["caption"].tolist()
  
      matcher = MultiModalPredictor(
          problem_type="image_text_similarity",
          hyperparameters={
              "model.clip.checkpoint_name": "openai/clip-vit-base-patch32"
          },
      )
      text_to_image_hits = semantic_search(
          matcher=matcher,
          query_data=text_list,
          response_data=image_list,
          top_k=5,
      )
  
      # extract embeddings first and then do semantic search
      query_embeddings = matcher.extract_embedding(
          text_list, as_tensor=True
      )
      response_embeddings = matcher.extract_embedding(
          image_list, as_tensor=True
      )
      text_to_image_hits_2 = semantic_search(
          matcher=matcher,
          query_embeddings=query_embeddings,
          response_embeddings=response_embeddings,
          top_k=5,
      )
  
      for per_query_hits, per_query_hits_2 in zip(
          text_to_image_hits, text_to_image_hits_2
      ):
          for per_hit, per_hit_2 in zip(
              per_query_hits, per_query_hits_2
          ):
              assert per_hit["response_id"] == per_hit_2["response_id"]
              npt.assert_almost_equal(
                  per_hit["score"], per_hit_2["score"]
              )
  
      image_to_text_hits = semantic_search(
          matcher=matcher,
          query_data=image_list,
          response_data=text_list,
          top_k=5,
      )
  
      # extract embeddings first and then do semantic search
      query_embeddings = matcher.extract_embedding(
          image_list, as_tensor=True
      )
      response_embeddings = matcher.extract_embedding(
          text_list, as_tensor=True
      )
      image_to_text_hits_2 = semantic_search(
          matcher=matcher,
          query_embeddings=query_embeddings,
          response_embeddings=response_embeddings,
          top_k=5,
      )
  
      for per_query_hits, per_query_hits_2 in zip(
          image_to_text_hits, image_to_text_hits_2
      ):
          for per_hit, per_hit_2 in zip(
              per_query_hits, per_query_hits_2
          ):
              assert per_hit["response_id"] == per_hit_2["response_id"]
              npt.assert_almost_equal(
                  per_hit["score"], per_hit_2["score"]
              )
  
file_path: autogluon/multimodal/tests/unittests/others/test_matcher.py
imports: import copy
  import os
  import pickle
  import shutil
  import tempfile
  import numpy.testing
  import pytest
  from autogluon.multimodal import MultiModalPredictor
  from autogluon.multimodal.constants import BINARY, MULTICLASS, QUERY, RESPONSE, UNIFORM_SOUP
  from autogluon.multimodal.utils import convert_data_for_ranking, semantic_search
  from ..utils.unittest_datasets import Flickr30kDataset, IDChangeDetectionDataset
  from ..utils.utils import get_home_dir
label_desc: Use image node_id 7 for calling a global function with example usage: test_image_text_semantic_search() without return types