fix: NameError 'has_reranker' in e2e-rag single-shot result display - #2667
Open
Anai-Guo wants to merge 1 commit into
Open
fix: NameError 'has_reranker' in e2e-rag single-shot result display#2667Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
evaluate_retrieval_query() references an undefined name has_reranker when print_results=True. single_shot_retrieval.py calls it with print_results=True and the default no_rerank=False, so any single-query lookup with reranking enabled raises NameError before printing reranked results. Use the same reranker-availability check already used earlier in the same function (around line 144) instead of the undefined variable. Signed-off-by: Tai An <antai12232931@outlook.com>
Contributor
|
MLCommons CLA bot: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
evaluate_retrieval_query()ine2e-rag/evaluation.pyreferences an undefinedname
has_rerankerwhen displaying results:has_rerankeris not defined anywhere in the function. This branch is guarded byif print_results:, andsingle_shot_retrieval.pycalls the function withprint_results=Trueand the defaultno_rerank=False:So any single-query lookup that runs with reranking enabled raises
NameError: name 'has_reranker' is not definedright where it should be printingthe reranked results.
Fix
Reuse the exact reranker-availability check the same function already performs
earlier (Step 2, ~line 144):
One-line change, no behavior change beyond removing the crash.
🤖 Generated with Claude Code