code: def get_class_weight(original_caption, prompt_prefix="a "):
      if isinstance(original_caption, str):
          if original_caption == "coco":
              from mmdet.datasets import CocoDataset
  
              class_names = CocoDataset.METAINFO["classes"]
          elif original_caption == "cityscapes":
              from mmdet.datasets import CityscapesDataset
  
              class_names = CityscapesDataset.METAINFO["classes"]
          elif original_caption == "voc":
              from mmdet.datasets import VOCDataset
  
              class_names = VOCDataset.METAINFO["classes"]
          elif original_caption == "openimages":
              from mmdet.datasets import OpenImagesDataset
  
              class_names = OpenImagesDataset.METAINFO["classes"]
          elif original_caption == "lvis":
              from mmdet.datasets import LVISV1Dataset
  
              class_names = LVISV1Dataset.METAINFO["classes"]
          else:
              if not original_caption.endswith("."):
                  original_caption = original_caption + " . "
              original_caption = original_caption.split(" . ")
              class_names = list(
                  filter(lambda x: len(x) > 0, original_caption)
              )
  
      # for test.py
      else:
          class_names = list(original_caption)
  
      text_encoder = CLIPTextEncoder()
      text_encoder.eval()
      texts = [prompt_prefix + x for x in class_names]
      print_log(
          f"Computing text embeddings for {len(class_names)} classes."
      )
      embeddings = (
          text_encoder(texts).detach().permute(1, 0).contiguous().cpu()
      )
      return class_names, embeddings
  
imports: import copy
  from typing import List, Union
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmengine.logging import print_log
  from torch import Tensor
  from mmdet.datasets import LVISV1Dataset
  from mmdet.models.detectors.cascade_rcnn import CascadeRCNN
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
label_desc: Use image node_id 1 for calling a global function with example usage: get_class_weight(original_caption, prompt_prefix) and returns: class_names,  embeddings