class_docstr: Compressed Indexer.
  
  If a FAISS index factory is specified, we build that.
  (see https://github.com/facebookresearch/faiss/wiki/The-index-factory)
  
  The default is IVF4096_HNSW128,PQ128; this also translates directly to the
  default when index_factory is specified as ''.
  
  See https://github.com/facebookresearch/faiss/wiki/Faiss-indexes#cell-probe-methods-indexivf-indexes
  for more details.
docstr: Train clustering index on list of vectors.
  
  :param vectors:
      a list of tensors to train on
docstr_tok: ["Train","clustering","index","on","list","of","vectors",".",":","param","vectors",":","a","list","of","tensors","to","train","on"]
code: def train(self, vectors: List[torch.Tensor]):
      """
      Train clustering index on list of vectors.
  
      :param vectors:
          a list of tensors to train on
      """
      start = time.time()
      for i, vecs in enumerate(grouper(vectors, self.span, None)):
          vec = torch.cat([v for v in vecs if v is not None])
          # sample
          num_samples = (
              min(50 * self.nlist, vec.size(0))
              if hasattr(self, "n_list")
              else vec.size(0) // 2
          )
          vec = vec[
              torch.LongTensor(
                  random.sample(range(vec.size(0)), num_samples)
              )
          ]
          logging.info(
              f"Training data {i+1}/{math.ceil(len(vectors) / self.span)} of shape {vec.shape}"
          )
          self.index.train(vec.float().numpy())
          logging.info(
              f"{time.time() - start:.2f}s Elapsed: training complete for {i+1}"
          )
  
imports: from parlai.core.build_data import modelzoo_path
  from parlai.core.opt import Opt
  import parlai.utils.logging
  from abc import ABC, abstractmethod
  import math
  import numpy
  import os
  import random
  import time
  import torch
  import torch.cuda
  from typing import List, Tuple, Optional
  from parlai.agents.rag.args import WIKIPEDIA_COMPRESSED_INDEX, WIKIPEDIA_EXACT_INDEX
label_desc: Use image node_id 3 for calling the CompressedIndexer obj's underlying member method code with example usage: obj.train(vectors) without return types