[neural search] fix the bug of reading files when calculating the recall scores #7836
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.
PR types
[ Bug fixes ]
PR changes
[ Scripts ]
Description
For this file 'applications/neural_search/recall/in_batch_negative/evaluate.py'.
If (the number of rows in 'similar_text_pair') mod ('recall_num') doesn't equal 0, the current code will still store the remaining rows in the 'rs' list, resulting in inconsistent list dimensions stored in the 'rs' list. Although it won't raise errors, logically there are some problems.
In this file 'applications/neural_search/recall/simcse/evaluate.py'.
The current loop will not save the last 'relevance_labels' list into the 'rs' list.
Therefore, the corrected code can be applied to the above two files. Besides, I think the issue should be similar for the following files:
examples/semantic_indexing/evaluate.py
applications/question_answering/supervised_qa/faq_system/evaluate.py
applications/question_answering/supervised_qa/faq_finance/evaluate.py
applications/text_classification/multi_class/retrieval_based/evaluate.py
applications/text_classification/hierarchical/retrieval_based/evaluate.py
I hadn't modified these files because I didn't check the usage in their modules. Please check those files. Thanks.