def show_attention_for_clip(model: nn.Module, pil_img: Image, text_list: List[str], device: str = None):
    """
    Show the attention for CLIP model. This function can show one image with multiple texts.
    Args:
        model (`nn.Module`):
            CLIP model to show attention.
        pil_img (`Image`):
            Image to show.
        text_list (`List[str]`):
            Text list to show.
        device (`str`):
            Device to use.

    """
    if device is None:
        device = 'cuda' if torch.cuda.is_available() else 'cpu'
    rel_text, rel_image, text_tokens, img_tensor = get_clip_relevance(model, pil_img, text_list, device)
    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
    batch_size = len(text_list)
    for i in range(batch_size):
        show_heatmap_on_text(text_list[i], text_tokens[i], rel_text[i])
        show_image_relevance(rel_image[i], img_tensor, orig_image=pil_img)
        plt.show()
Show the attention for CLIP model. This function can show one image with multiple texts.
Args:
model (`nn.Module`):
CLIP model to show attention.
pil_img (`Image`):
Image to show.
text_list (`List[str]`):
Text list to show.
device (`str`):
Device to use.
towhee/models/visualization/clip_visualization.py