Efficient interpolation-based ranking on CPUs
Project description
Fast-Forward Indexes
This is the implementation of Fast-Forward indexes.
Important: As this library is still in its early stages, the API is subject to change!
Installation
Install the package via pip
:
pip install fast-forward-indexes
Getting Started
Using a Fast-Forward index is as simple as providing a TREC run with retrieval scores:
from pathlib import Path
from fast_forward import OnDiskIndex, Mode, Ranking
from fast_forward.encoder import TCTColBERTQueryEncoder
# choose a pre-trained query encoder
encoder = TCTColBERTQueryEncoder("castorini/tct_colbert-msmarco")
# load an index on disk
ff_index = OnDiskIndex.load(Path("/path/to/index.h5"), encoder, mode=Mode.MAXP)
# load a run (TREC format) and attach all required queries
first_stage_ranking = (
Ranking.from_file(Path("/path/to/input/run.tsv"))
.attach_queries(
{
"q1": "query 1",
"q2": "query 2",
# ...
"qn": "query n",
}
)
.cut(5000)
)
# compute the corresponding semantic scores
out = ff_index(first_stage_ranking)
# interpolate scores and create a new TREC runfile
first_stage_ranking.interpolate(out, 0.1).save(Path("/path/to/output/run.tsv"))
Documentation
A more detailed documentation is available here.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fast_forward_indexes-0.3.1.tar.gz
(30.3 kB
view hashes)
Built Distribution
Close
Hashes for fast_forward_indexes-0.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33238643a0c3672527763747c4ed61f4292d3b77fa2701be1e506eb46bb30411 |
|
MD5 | 12b33f67e151152d9da98203a35d8a81 |
|
BLAKE2b-256 | d1639c6d37d8042b3ca01e4bb75187087f41f0074caba1328018dce9396de63f |
Close
Hashes for fast_forward_indexes-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7477230bfdb9cd4488db7c33b97e554f334cbe230b929c950ccec4c4d4d0d3dc |
|
MD5 | 8ab440315d870a2e97347fbfb9f554ae |
|
BLAKE2b-256 | dad568b8b6df55375c4eeb0b7b29aefdddf82bf5a8fb4794f6c5ebf69096dcac |