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.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.2.1.tar.gz
(24.6 kB
view hashes)
Built Distribution
Close
Hashes for fast_forward_indexes-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3693b10af6ab4d4523eff765bde864800f43cb5b38274d2476498f30e5699c0 |
|
MD5 | cbb38a4d95e9870ba2a9471c0db0226b |
|
BLAKE2b-256 | 9f47b6820132718bd2352b68a4cc8c49d11a55a6d8e3e3e28b5738b7044e90a2 |
Close
Hashes for fast_forward_indexes-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c63823b9d7109a30ed6ef13b530ba97b08c06472e2003d690bd725c05226a1fa |
|
MD5 | 9b35ab451d4dab87f91163d35352b28b |
|
BLAKE2b-256 | 22fe7cc01fd8742cccbfad3645ffcf86d918d288dd53e11a08d9db42ceb0b247 |