FaissFlatIndexer

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

Bases: FaissIndexer

FAISS Flat Indexer for exact nearest neighbor search using FAISS.

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

Initialize the FaissFlatIndexer.

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

  • index_config (FaissFlatIndexConfig) – Configuration for the FAISS flat 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 FaissFlatIndexer.

to_cpu()

Move the FAISS flat index to CPU.

to_gpu()

Move the FAISS flat index to GPU.

Attributes

INDEX_FACTORY

to_cpu() None[source]

Move the FAISS flat index to CPU.

to_gpu() None[source]

Move the FAISS flat index to GPU.