FaissIVFIndexer

class lightning_ir.retrieve.faiss.faiss_indexer.FaissIVFIndexer(index_dir: Path, index_config: FaissIVFIndexConfig, module: BiEncoderModule, verbose: bool = False)[source]

Bases: _FaissTrainIndexer

FAISS IVF Indexer for approximate nearest neighbor search using FAISS with Inverted File System (IVF).

__init__(index_dir: Path, index_config: FaissIVFIndexConfig, module: BiEncoderModule, verbose: bool = False) None[source]

Initialize the FaissIVFIndexer.

Parameters:
  • index_dir (Path) – Directory where the index will be stored.

  • index_config (FaissIVFIndexConfig) – Configuration for the FAISS IVF index.

  • module (BiEncoderModule) – The BiEncoderModule to use for indexing.

  • verbose (bool) – Whether to enable verbose output. Defaults to False.

Methods

__init__(index_dir, index_config, module[, ...])

Initialize the FaissIVFIndexer.

set_verbosity([verbose])

Set the verbosity of the FAISS IVF index.

to_cpu()

Move the FAISS IVF index to CPU.

to_gpu()

Move the FAISS IVF index to GPU.

Attributes

INDEX_FACTORY

set_verbosity(verbose: bool | None = None) None[source]

Set the verbosity of the FAISS IVF index.

Parameters:

verbose (bool | None) – Whether to enable verbose output. Defaults to None.

to_cpu() None[source]

Move the FAISS IVF index to CPU.

to_gpu() None[source]

Move the FAISS IVF index to GPU.