TupleDataset
- class lightning_ir.data.dataset.TupleDataset(tuples_dataset: str, targets: Literal['order', 'score'] = 'order', num_docs: int | None = None)[source]
Bases:
IRDataset,IterableDataset- __init__(tuples_dataset: str, targets: Literal['order', 'score'] = 'order', num_docs: int | None = None) None[source]
Dataset containing tuples of a query and n-documents. Used for fine-tuning models on ranking tasks.
- Parameters:
tuples_dataset (str) – Path to file containing tuples or valid ir_datasets id.
targets (Literal["order", "score"], optional) – Data type to use as targets for a model during fine-tuning. Defaults to “order”.
num_docs (int | None, optional) – Maximum number of documents per query. Defaults to None.
Methods
__init__(tuples_dataset[, targets, num_docs])Dataset containing tuples of a query and n-documents.
Downloads tuples using ir_datasets if needed.
Attributes
- property DASHED_DATASET_MAP: Dict[str, str]
Map of dataset names with dashes to dataset names with slashes.
- Returns:
Dataset map.
- Return type:
Dict[str, str]
- property docs: Docstore | Dict[str, GenericDoc]
Documents in the dataset.
- Returns:
Documents.
- Return type:
ir_datasets.indices.Docstore | Dict[str, GenericDoc]
- Raises:
ValueError – If no documents are found in the dataset.
- property docs_dataset_id: str
ID of the dataset containing the documents.
- Returns:
Document dataset id.
- Return type:
str
- property ir_dataset: Dataset | None
Instance of ir_datasets.Dataset.
- Returns:
Instance of ir_datasets.Dataset or None if the dataset is not found.
- Return type:
ir_datasets.Dataset | None
- prepare_constituent(constituent: Literal['qrels', 'queries', 'docs', 'scoreddocs', 'docpairs']) None
Downloads the constituent of the dataset using ir_datasets if needed.
- Parameters:
constituent (Literal["qrels", "queries", "docs", "scoreddocs", "docpairs"]) – Constituent to download.
- prepare_data() None[source]
Downloads tuples using ir_datasets if needed.