Skip to content

fix(eval): load MSMARCO remote qrels when dataset_dir is not set - #1605

Open
MohammadHijjawi97 wants to merge 1 commit into
FlagOpen:masterfrom
MohammadHijjawi97:fix/msmarco-remote-qrels-without-dataset-dir
Open

MohammadHijjawi97 wants to merge 1 commit into
FlagOpen:masterfrom
MohammadHijjawi97:fix/msmarco-remote-qrels-without-dataset-dir

Conversation

@MohammadHijjawi97

Copy link
Copy Markdown

Problem

When MSMARCO evaluation is run without --dataset_dir (documented as "the dataset will be only downloaded to the cache directory"), MSMARCOEvalDataLoader._load_remote_qrels takes the branch that reads qrels without saving them. The check there is inverted (if qrels_save_path is None:), so:

  • for dl19 / dl20 (passage and document) and document dev, the downloaded TREC qrels file is skipped and the code iterates the HF qrels variable that was never assigned: UnboundLocalError: cannot access local variable 'qrels'
  • for passage dev, it calls open(None): TypeError

Fix

Flip the condition to if qrels_save_path is not None:, matching the save_dir branch just above it.

Tests

Added tests/test_msmarco_data_loader.py, which mocks _download_file with a tiny TREC-style qrels file (no network) and checks load_qrels for passage/document x dl19/dl20.

  • Before the fix: 4 failed (UnboundLocalError)
  • After the fix: 4 passed

pytest tests/test_msmarco_data_loader.py

When no dataset_dir is given, MSMARCOEvalDataLoader._load_remote_qrels
reads qrels without saving them, but the check on qrels_save_path was
inverted. For the dl19/dl20 splits (and document dev) it skipped the
downloaded TREC file and iterated the undefined HF `qrels`, raising
UnboundLocalError; for passage dev it tried to open(None).

Flip the condition to match the save_dir branch and add a regression
test that mocks the download.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant