"...git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "9802b9340dd45ee133620dcd60c344423d2d7ae4"
Unverified Commit 29e45979 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Fix min_null_pred in the run_qa script (#9067)

parent 9cc9f412
...@@ -76,9 +76,7 @@ def postprocess_qa_predictions( ...@@ -76,9 +76,7 @@ def postprocess_qa_predictions(
assert len(predictions) == 2, "`predictions` should be a tuple with two elements (start_logits, end_logits)." assert len(predictions) == 2, "`predictions` should be a tuple with two elements (start_logits, end_logits)."
all_start_logits, all_end_logits = predictions all_start_logits, all_end_logits = predictions
assert len(predictions[0]) == len( assert len(predictions[0]) == len(features), f"Got {len(predictions[0])} predictions and {len(features)} features."
features
), f"Got {len(predictions[0])} predicitions and {len(features)} features."
# Build a map example to its corresponding features. # Build a map example to its corresponding features.
example_id_to_index = {k: i for i, k in enumerate(examples["id"])} example_id_to_index = {k: i for i, k in enumerate(examples["id"])}
...@@ -118,7 +116,7 @@ def postprocess_qa_predictions( ...@@ -118,7 +116,7 @@ def postprocess_qa_predictions(
# Update minimum null prediction. # Update minimum null prediction.
feature_null_score = start_logits[0] + end_logits[0] feature_null_score = start_logits[0] + end_logits[0]
if min_null_prediction is None or min_null_prediction["score"] < feature_null_score: if min_null_prediction is None or min_null_prediction["score"] > feature_null_score:
min_null_prediction = { min_null_prediction = {
"offsets": (0, 0), "offsets": (0, 0),
"score": feature_null_score, "score": feature_null_score,
......
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