PlaidSearcher
- class lightning_ir.retrieve.plaid.plaid_searcher.PlaidSearcher(index_dir: Path, search_config: PlaidSearchConfig, module: BiEncoderModule, use_gpu: bool = False)[source]
Bases:
SearcherSearcher for Plaid using fast-plaid library.
- __init__(index_dir: Path, search_config: PlaidSearchConfig, module: BiEncoderModule, use_gpu: bool = False) None[source]
Initialize the PlaidSearcher.
- Parameters:
index_dir (Path | str) – Directory where the Plaid index is stored.
search_config (PlaidSearchConfig) – Configuration for the Plaid searcher.
module (BiEncoderModule) – The BiEncoder module used for searching.
use_gpu (bool) – Whether to use GPU for searching. Defaults to False.
Methods
__init__(index_dir, search_config, module[, ...])Initialize the PlaidSearcher.
search(output)Search for relevant documents using the Plaid index.
- search(output: BiEncoderOutput) Tuple[PackedTensor, List[List[str]]][source]
Search for relevant documents using the Plaid index.
- Parameters:
output (BiEncoderOutput) – The output from the BiEncoder module containing query embeddings.
- Returns:
A tuple containing the scores and the corresponding document IDs.
- Return type:
Tuple[PackedTensor, List[List[str]]]
- Raises:
ValueError – If the output does not contain query embeddings.
ValueError – If the index is not loaded. Call load() before searching.