{"record":{"id":"17b5c7cfd52e601e","repo":"tensorflow/models","slug":"eval-squad-only-supports-one-predict-file-but-g","errorCode":null,"errorMessage":"`eval_squad` only supports one predict file, but got %s","messagePattern":"`eval_squad` only supports one predict file, but got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/bert/run_squad_helper.py","lineNumber":431,"sourceCode":"          os.path.basename(all_predict_files[idx]))[0]\n    dump_to_files(all_predictions, all_nbest_json, scores_diff_json, squad_lib,\n                  input_meta_data.get('version_2_with_negative', False),\n                  file_prefix)\n\n\ndef eval_squad(strategy,\n               input_meta_data,\n               tokenizer,\n               bert_config,\n               squad_lib,\n               init_checkpoint=None):\n  \"\"\"Get prediction results and evaluate them against ground truth.\"\"\"\n  if init_checkpoint is None:\n    init_checkpoint = tf.train.latest_checkpoint(FLAGS.model_dir)\n\n  all_predict_files = _get_matched_files(FLAGS.predict_file)\n  if len(all_predict_files) != 1:\n    raise ValueError('`eval_squad` only supports one predict file, '\n                     'but got %s' % all_predict_files)\n\n  squad_model = get_squad_model_to_predict(strategy, bert_config,\n                                           init_checkpoint, input_meta_data)\n  all_predictions, all_nbest_json, scores_diff_json = prediction_output_squad(\n      strategy, input_meta_data, tokenizer, squad_lib, all_predict_files[0],\n      squad_model)\n  dump_to_files(all_predictions, all_nbest_json, scores_diff_json, squad_lib,\n                input_meta_data.get('version_2_with_negative', False))\n\n  with tf.io.gfile.GFile(FLAGS.predict_file, 'r') as reader:\n    dataset_json = json.load(reader)\n    pred_dataset = dataset_json['data']\n  if input_meta_data.get('version_2_with_negative', False):\n    eval_metrics = squad_evaluate_v2_0.evaluate(pred_dataset, all_predictions,\n                                                scores_diff_json)\n  else:\n    eval_metrics = squad_evaluate_v1_1.evaluate(pred_dataset, all_predictions)","sourceCodeStart":413,"sourceCodeEnd":449,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/bert/run_squad_helper.py#L413-L449","documentation":"Error \"`eval_squad` only supports one predict file, but got %s\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/bert/run_squad_helper.py:431 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}