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.1.tar.gz
.
File metadata
- Download URL: fast_forward_indexes-0.5.1.tar.gz
- Upload date:
- Size: 33.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c38a217e202af042e18a3769d529f2abc2a46a802b75ee0575a8a858ed0b535 |
|
MD5 | fa1bce8e034589813175ad32badda645 |
|
BLAKE2b-256 | 2dc921912668629a9eb0e440d78b2e2288f006054c44533194b1d8a815e2633c |
Provenance
The following attestation bundles were made for fast_forward_indexes-0.5.1.tar.gz
:
Publisher:
publish_pypi.yml
on mrjleo/fast-forward-indexes
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
fast_forward_indexes-0.5.1.tar.gz
- Subject digest:
1c38a217e202af042e18a3769d529f2abc2a46a802b75ee0575a8a858ed0b535
- Sigstore transparency entry: 146389043
- Sigstore integration time:
- Predicate type:
File details
Details for the file fast_forward_indexes-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: fast_forward_indexes-0.5.1-py3-none-any.whl
- Upload date:
- Size: 34.2 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 | f4fbc31c198f3c80b26b0421510060ab92d83b16b7f0e44ee84c238eeac7bb0b |
|
MD5 | 2073ce6fc4d990cf738b1e442a0297e6 |
|
BLAKE2b-256 | fb2e15f0096b5b9f17092d5608d1ad5df5b5bf77bae7907ebefa9952a14eec69 |
Provenance
The following attestation bundles were made for fast_forward_indexes-0.5.1-py3-none-any.whl
:
Publisher:
publish_pypi.yml
on mrjleo/fast-forward-indexes
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
fast_forward_indexes-0.5.1-py3-none-any.whl
- Subject digest:
f4fbc31c198f3c80b26b0421510060ab92d83b16b7f0e44ee84c238eeac7bb0b
- Sigstore transparency entry: 146389045
- Sigstore integration time:
- Predicate type: