class_docstr: multimodal vector retriver:
  text retrieve video or video retrieve text.
class_docstr_tok: ["multimodal","vector","retriver",":","text","retrieve","video","or","video","retrieve","text","."]
docstr: hidden_states is a pair `(video, text)`
docstr_tok: ["hidden_states","is","a","pair","`","(","video",",","text",")","`"]
code: def add(self, hidden_states, video_ids):
      """hidden_states is a pair `(video, text)`"""
      assert len(hidden_states) == len(video_ids), "{}, {}".format(
          str(len(hidden_states)), str(len(video_ids))
      )
      assert len(hidden_states.shape) == 3
      assert len(self.video_to_videoid) == 0
  
      valid_idx = []
      for idx, video_id in enumerate(video_ids):
          if video_id not in self.videoid_to_vectoridx:
              valid_idx.append(idx)
              self.videoid_to_vectoridx[video_id] = len(
                  self.videoid_to_vectoridx
              )
  
      batch_size = hidden_states.shape[0]
      hidden_states = hidden_states[valid_idx]
  
      hidden_states = np.transpose(hidden_states, (1, 0, 2)).copy()
      if not self.db["video"].is_trained:
          self.train_cache.append(hidden_states)
          train_len = batch_size * len(self.train_cache)
          if train_len < self.train_thres:
              return
  
          hidden_states = np.concatenate(self.train_cache, axis=1)
          del self.train_cache
          self.db["video"].train(hidden_states[0, : self.train_thres])
          self.db["text"].train(hidden_states[1, : self.train_thres])
      self.db["video"].add(hidden_states[0])
      self.db["text"].add(hidden_states[1])
  
imports: import os
  import numpy
  import pickle
  import time
  from collections import defaultdict
  from ..utils import get_local_rank, print_on_rank0
label_desc: Use image node_id 6 for calling the MMVectorRetriever obj's underlying member method code with example usage: obj.add(hidden_states, video_ids) without return types