class_docstr: Each index for a retrieval model is specific to the clip model used and the dataset used.
code: def build_index(
      self,
      model=None,
      feature_extractor: CLIPFeatureExtractor = None,
      torch_dtype=torch.float32,
  ):
      if not self.index_initialized:
          model = model or CLIPModel.from_pretrained(
              self.config.clip_name_or_path
          ).to(dtype=torch_dtype)
          feature_extractor = (
              feature_extractor
              or CLIPFeatureExtractor.from_pretrained(
                  self.config.clip_name_or_path
              )
          )
          self.dataset = get_dataset_with_emb_from_clip_model(
              self.dataset,
              model,
              feature_extractor,
              image_column=self.config.image_column,
              index_name=self.config.index_name,
          )
          self.init_index()
  
imports: import os
  from typing import List
  import faiss
  import numpy
  import torch
  from datasets import Dataset, load_dataset
  from PIL import Image
  from transformers import CLIPFeatureExtractor, CLIPModel, PretrainedConfig
  from diffusers import logging
label_desc: Use image node_id 4 for calling the Index obj's underlying member method code with example usage: obj.build_index(model, feature_extractor, torch_dtype) without return types