[Fix] triviaqa & nq postprocess (#350)

This commit is contained in:
Leymore 2023-09-04 15:24:52 +08:00 committed by GitHub
parent ce65d3393b
commit a1782f9a08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ class NQEvaluator(BaseEvaluator):
} }
processed_predictions = [] processed_predictions = []
for prediction in predictions: for prediction in predictions:
prediction = prediction.split('\n')[0].lower() prediction = prediction.strip().split('\n')[0].lower()
if 'answer is' in prediction: if 'answer is' in prediction:
prediction = prediction.split('answer is')[-1] prediction = prediction.split('answer is')[-1]
prediction = general_postprocess(prediction) prediction = general_postprocess(prediction)

View File

@ -43,7 +43,7 @@ class TriviaQAEvaluator(BaseEvaluator):
} }
processed_predictions = [] processed_predictions = []
for prediction in predictions: for prediction in predictions:
prediction = prediction.split('\n')[0].lower() prediction = prediction.strip().split('\n')[0].lower()
if 'answer is' in prediction: if 'answer is' in prediction:
prediction = prediction.split('answer is')[-1] prediction = prediction.split('answer is')[-1]
prediction = general_postprocess(prediction) prediction = general_postprocess(prediction)