google-research / bert

TensorFlow code and pre-trained models for BERT
https://arxiv.org/abs/1810.04805
Apache License 2.0
37.82k stars 9.56k forks source link

KeyError: 1000000000 write_predictions (run_squad.py) #1028

Open tusharsh23 opened 4 years ago

tusharsh23 commented 4 years ago

Face the below issue while running squad.

Traceback (most recent call last): File "run_squad.py", line 1286, in tf.app.run() File "/env/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "run_squad.py", line 1279, in main output_nbest_file, output_null_log_odds_file) File "run_squad.py", line 777, in write_predictions result = unique_id_to_result[feature.unique_id] KeyError: 1000000000

liulizuel commented 2 years ago

I also encountered this problem, when I used a pre-trained model XLNetForQuestionAnsweringSimple to predict a QA task.

result = evaluate(args, model, tokenizer, prefix=global_step)

File "run_factoid_pytorch.py", line 718, in evaluate args.verbose_logging, File "/home/zhuzz/anaconda3/envs/BioAsq9/lib/python3.7/site-packages/transformers/data/metrics/squad_metrics.py", line 640, in compute_predictions_log_probs result = unique_id_to_result[feature.unique_id] KeyError: 1000000000