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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fast_forward_indexes-0.5.0.tar.gz
.
File metadata
- Download URL: fast_forward_indexes-0.5.0.tar.gz
- Upload date:
- Size: 33.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c5ee7464d8c4aa24f5017197583da2a76fe32bb1d9af4dca47a9530b144a1bf |
|
MD5 | 1483ed3fbc0a03b0bf582909f7d2ac17 |
|
BLAKE2b-256 | 7ad2220de9028708917b67e1c4603b5029dbb4e27751ff92faab4c9fd5e1a45e |
File details
Details for the file fast_forward_indexes-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: fast_forward_indexes-0.5.0-py3-none-any.whl
- Upload date:
- Size: 34.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e29c68354a2fdae55627ed0e5f4aeb988a1c15dc27f9463b08b5d9fd9f96e12 |
|
MD5 | b25eadea845b7269a89ec9f491629614 |
|
BLAKE2b-256 | ee0dddc1b27a69c084e8ba1141bdf0742b7b4927e0d85101c97f6f437995fa68 |