The Dataset Viewer has been disabled on this dataset.

Dense index of the BRIGHT Sustainable Living collection for PyTerrier

Description

A dense index of the sustainable-living subset of the BRIGHT dataset build with PyTerrier's DR plugin.

Usage

You will need to install PyTerrier, and its DR engine:

%pip install pyterrier
%pip install pyterrier-dr
# Load the artifact
import pyterrier as pt
artifact = pt.Artifact.from_hf('pyterrier-tutorial/bright.sustainable.mini.dense')
# TODO: Show how you use the artifact

Reproduction

import pyterrier as pt
from pyterrier_dr import SBertBiEncoder, FlexIndex

dataset = pt.get_dataset('irds:bright/sustainable-living')

model_mini = SBertBiEncoder(
    "sentence-transformers/all-MiniLM-L6-v2",
    batch_size=32,
    text_field="text"
)

dense_path_mini = "./bright-mini.flex"

if os.path.exists(dense_path_mini):
    shutil.rmtree(dense_path_mini)

dense_index_mini = FlexIndex(dense_path_mini)
dense_indexer_mini = model_mini.doc_encoder() >> dense_index_mini.indexer(mode="overwrite")
dense_indexer_mini.index(dataset.get_corpus_iter())

Metadata

{
  "type": "dense_index",
  "format": "flex",
  "vec_size": 384,
  "doc_count": 60792
}
Downloads last month
34