code: def get_text_embeddings(
      dataset=None, custom_vocabulary=None, prompt_prefix="a "
  ):
      assert (dataset is None) ^ (
          custom_vocabulary is None
      ), "Either `dataset` or `custom_vocabulary` should be specified."
      if dataset:
          if dataset in DATASET_EMBEDDINGS:
              return DATASET_EMBEDDINGS[dataset]
          else:
              custom_vocabulary = get_class_names(dataset)
  
      text_encoder = CLIPTextEncoder()
      text_encoder.eval()
      texts = [prompt_prefix + x for x in custom_vocabulary]
      print_log(
          f"Computing text embeddings for {len(custom_vocabulary)} classes."
      )
      embeddings = (
          text_encoder(texts).detach().permute(1, 0).contiguous().cpu()
      )
      return embeddings
  
file_path: mmdetection/projects/Detic/detic/utils.py
imports: import numpy
  import torch
  import torch.nn.functional
  from mmengine.logging import print_log
  from .text_encoder import CLIPTextEncoder
label_desc: Use image node_id 1 for calling a global function with example usage: get_text_embeddings(dataset, custom_vocabulary, prompt_prefix) and returns: embeddings, DATASET_EMBEDDINGS