The Dataset Viewer has been disabled on this dataset.
msmarco-passage.tct-hnp.flex
Description
This artifact represents the retrieval index of the MSMarco Passage collection produced by your TCT-ColBERT model (version hnp).
Usage
The following code snippete shows how to use this artifact to perform a dense retrieval experiment:
import pyterrier as pt
import pyterrier_dr
from pyterrier.measures import *
# Load the artifact
index = pt.Artifact.from_hf('ntonellotto/msmarco-passage.tct-hnp.flex')
# Load the query encoder (must be the same used to create the artifact)
model = pyterrier_dr.TctColBert.hnp()
# Load the dataset
dataset = pt.get_dataset('msmarco_passage')
# Run the PyTerrier experiment
pt.Experiment(
[model >> index],
dataset.get_topics('test-2019'),
dataset.get_qrels('test-2019'),
eval_metrics=[RR@10, Recall(rel=2)@100, Recall@100, nDCG@10, "mrt"],
names=["Dense Retrieval"]
)
You should get something like:
| name | RR@10 | R(rel=2)@100 | R@100 | nDCG@10 | mrt |
|---|---|---|---|---|---|
| Dense Retrieval | 0.976744 | 0.607269 | 0.514744 | 0.718238 | 280.014161 |
Reproduction
Generating the data
The data has been generated using the following code snippet:
import torch
import pyterrier as pt
import pyterrier_dr
# Select the available Torch's backend
if torch.backends.mps.is_available():
device = torch.device("mps")
elif torch.cuda.is_available():
device = torch.device("cuda")
else:
device = torch.device("cpu")
print(f"Using device: {device}")
# Create the encoder model
tct = pyterrier_dr.TctColBert.hnp(device=device)
# Create the destination index folder
index = pyterrier_dr.FlexIndex("./msmarco-passage.tct-hnp.flex")
# Indexing
(tct >> index).index(pt.get_dataset("msmarco_passage").get_corpus_iter())
print(f"Indexed {len(index)} documents")
Uploading the data
To upload the index to Hugging Face, use the following code snippet (the dataset sheet will be created automatically):
import pyterrier as pt
# Load the artifact from disk
artifact = pt.Artifact.load("./msmarco-passage.tct-hnp.flex")
# Upload the artifact to HF
artifact.to_hf('ntonellotto/msmarco-passage.tct-hnp.flex')
Metadata
{
"type": "dense_index",
"format": "flex",
"vec_size": 768,
"doc_count": 8841823
}
- Downloads last month
- 4