primeqa.ir.dense.colbert_top.colbert.search.index_storage.IndexScorer#

class primeqa.ir.dense.colbert_top.colbert.search.index_storage.IndexScorer(index_path, use_gpu)#

Bases: primeqa.ir.dense.colbert_top.colbert.search.index_loader.IndexLoader, primeqa.ir.dense.colbert_top.colbert.search.candidate_generation.CandidateGeneration

Methods

embedding_ids_to_pids

generate_candidate_eids

generate_candidate_pids

generate_candidate_scores

generate_candidates

get_cells

lookup_eids

lookup_pids

rank

retrieve

score_pids

Always supply a flat list or tensor for pids.

try_load_torch_extensions

Attributes

config

metadata

num_chunks

num_embeddings

score_pids(config, Q, pids, centroid_scores)#

Always supply a flat list or tensor for pids.

Supply sizes Q = (1 | num_docs, , dim) and D = (num_docs, *, dim). If Q.size(0) is 1, the matrix will be compared with all passages. Otherwise, each query matrix will be compared against the *aligned passage.