From a7fce6d9176cf3662d153af54270f345eb0bec8d Mon Sep 17 00:00:00 2001 From: Chi-Liang Liu Date: Wed, 24 Jul 2019 16:11:36 +0800 Subject: [PATCH] fix squad v1 error (na_prob_file should be None) --- examples/run_squad.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/run_squad.py b/examples/run_squad.py index 36e03fb012..df8e3b4a82 100644 --- a/examples/run_squad.py +++ b/examples/run_squad.py @@ -241,7 +241,10 @@ def evaluate(args, model, tokenizer, prefix=""): # Compute predictions output_prediction_file = os.path.join(args.output_dir, "predictions_{}.json".format(prefix)) output_nbest_file = os.path.join(args.output_dir, "nbest_predictions_{}.json".format(prefix)) - output_null_log_odds_file = os.path.join(args.output_dir, "null_odds_{}.json".format(prefix)) + if args.version_2_with_negative: + output_null_log_odds_file = os.path.join(args.output_dir, "null_odds_{}.json".format(prefix)) + else: + output_null_log_odds_file = None if args.model_type in ['xlnet', 'xlm']: # XLNet uses a more complex post-processing procedure