code: def show_heatmap_on_text(
      text: str, text_encoding: torch.Tensor, rel_text: torch.Tensor
  ):
      """
      Show the text relevance heatmap.
      Args:
          text (`str`):
              Text to show.
          text_encoding (`torch.Tensor`):
              Tokenized text.
          rel_text (`torch.Tensor`):
              Text relevance.
  
      """
      if not is_captum_available():
          models_log.warning(
              "You should install Captum first. Please run `pip install captum`."
          )
          return None
      from captum.attr import (
          visualization as viz,
      )  # pylint: disable=import-outside-toplevel
  
      if not is_matplotlib_available():
          models_log.warning("Matplotlib is not available.")
      from towhee.utils.matplotlib_utils import matplotlib
      import matplotlib.pylab as plt  # pylint: disable=import-outside-toplevel
  
      tokenizer = SimpleTokenizer()
  
      cls_idx = text_encoding.argmax(dim=-1)
      rel_text = rel_text[cls_idx, 1:cls_idx]
      text_scores = rel_text / rel_text.sum()
      text_scores = text_scores.flatten()
      text_tokens = tokenizer.encode(text)
      text_tokens_decoded = [tokenizer.decode([a]) for a in text_tokens]
      vis_data_records = [
          viz.VisualizationDataRecord(
              text_scores, 0, 0, 0, 0, 0, text_tokens_decoded, 1
          )
      ]
      viz.visualize_text(vis_data_records)
      plt.show()
  
file_path: towhee/towhee/models/visualization/clip_visualization.py
imports: from typing import List, Tuple, Callable
  from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize
  from torch import nn
  from towhee.utils.pil_utils import PILImage
  from towhee.models.visualization.transformer_visualization import _reshape_attr_and_get_heatmap
  from towhee.models import clip
  from towhee.models.clip import SimpleTokenizer
  from towhee.trainer.utils.file_utils import is_captum_available, is_matplotlib_available
  from towhee.utils.log import models_log
  import torch
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: show_heatmap_on_text(text, text_encoding, rel_text) and returns: None