code: def main(params):
      output_path = params["output_path"]
  
      logger.info(
          "Loading candidate encoding from path: %s"
          % params["candidate_encoding"]
      )
      candidate_encoding = torch.load(params["candidate_encoding"])
      vector_size = candidate_encoding.size(1)
      index_buffer = params["index_buffer"]
      if params["faiss_index"] == "hnsw":
          logger.info("Using HNSW index in FAISS")
          index = DenseHNSWFlatIndexer(vector_size, index_buffer)
      elif params["faiss_index"] == "ivfflat":
          logger.info("Using IVF Flat index in FAISS")
          index = DenseIVFFlatIndexer(vector_size, 75, 100)
      else:
          logger.info("Using Flat index in FAISS")
          index = DenseFlatIndexer(vector_size, index_buffer)
  
      logger.info("Building index.")
      index.index_data(candidate_encoding.numpy())
      logger.info("Done indexing data.")
  
      if params.get("save_index", None):
          index.serialize(output_path)
  
file_path: BLINK/elq/build_faiss_index.py
imports: import argparse
  import logging
  import numpy
  import os
  import time
  import torch
  from elq.index.faiss_indexer import DenseFlatIndexer, DenseIVFFlatIndexer, DenseHNSWFlatIndexer
  import elq.candidate_ranking.utils
label_desc: Use image node_id 1 for calling a global function with example usage: main(params) without return types