SeismicIndexer

class lightning_ir.retrieve.seismic.seismic_indexer.SeismicIndexer(index_dir: Path, index_config: SeismicIndexConfig, module: BiEncoderModule, verbose: bool = False)[source]

Bases: Indexer

Indexer for Seismic, a residual-based indexing method for efficient retrieval.

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

Initialize the SeismicIndexer.

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

  • index_config (SeismicIndexConfig) – Configuration for the Seismic indexer.

  • module (BiEncoderModule) – The BiEncoder module used for indexing.

  • verbose (bool) – Whether to print verbose output during indexing. Defaults to False.

Raises:

ImportError – If the seismic package is not available.

Methods

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

Initialize the SeismicIndexer.

add(index_batch, output)

Add embeddings from the index batch to the Seismic index.

save()

Save the Seismic index to disk.

add(index_batch: IndexBatch, output: BiEncoderOutput) None[source]

Add embeddings from the index batch to the Seismic index.

Parameters:
  • index_batch (IndexBatch) – Batch of data containing embeddings to be indexed.

  • output (BiEncoderOutput) – Output from the BiEncoder module containing embeddings.

Raises:

ValueError – If the output does not contain document embeddings.

save() None[source]

Save the Seismic index to disk.