Unverified Commit aef4cf8c authored by SHYAM SUNDER KUMAR's avatar SHYAM SUNDER KUMAR Committed by GitHub
Browse files

accelerate question answering examples with no trainer (#11091)



* accelerate question answering examples with no trainer

* removed train and eval flags also fixed fill np array function

* Update examples/question-answering/run_qa_beam_search_no_trainer.py
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>

* Update examples/question-answering/run_qa_no_trainer.py
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
parent 403d530e
This diff is collapsed.
This diff is collapsed.
...@@ -335,9 +335,9 @@ def postprocess_qa_predictions_with_beam_search( ...@@ -335,9 +335,9 @@ def postprocess_qa_predictions_with_beam_search(
# Go through all possibilities for the `n_start_top`/`n_end_top` greater start and end logits. # Go through all possibilities for the `n_start_top`/`n_end_top` greater start and end logits.
for i in range(start_n_top): for i in range(start_n_top):
for j in range(end_n_top): for j in range(end_n_top):
start_index = start_indexes[i] start_index = int(start_indexes[i])
j_index = i * end_n_top + j j_index = i * end_n_top + j
end_index = end_indexes[j_index] end_index = int(end_indexes[j_index])
# Don't consider out-of-scope answers (last part of the test should be unnecessary because of the # Don't consider out-of-scope answers (last part of the test should be unnecessary because of the
# p_mask but let's not take any risk) # p_mask but let's not take any risk)
if ( if (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment