{"record":{"id":"9aee6fc9fa3eca64","repo":"tensorflow/models","slug":"vocab-must-be-set-as-the-filepath-of-bert-vocabula","errorCode":null,"errorMessage":"vocab must be set as the filepath of BERT vocabulary.","messagePattern":"vocab must be set as the filepath of BERT vocabulary\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/nhnet/raw_data_process.py","lineNumber":72,"sourceCode":"  os.makedirs(output_folder, exist_ok=True)\n  output_filepaths = []\n  for i in range(FLAGS.num_tfrecords_shards):\n    output_filepaths.append(\n        os.path.join(\n            output_folder, \"%s.tfrecord-%.5d-of-%.5d\" %\n            (filename, i, FLAGS.num_tfrecords_shards)))\n  (total_num_examples,\n   generated_num_examples) = data_processor.generate_examples(\n       story_filepath, output_filepaths)\n  print(\"For %s, %d examples have been generated from %d stories in json.\" %\n        (filename, generated_num_examples, total_num_examples))\n\n\ndef main(_):\n  if not FLAGS.data_folder:\n    raise ValueError(\"data_folder must be set as the downloaded folder path.\")\n  if not FLAGS.vocab:\n    raise ValueError(\"vocab must be set as the filepath of BERT vocabulary.\")\n  data_processor = raw_data_processor.RawDataProcessor(\n      vocab=FLAGS.vocab,\n      do_lower_case=FLAGS.do_lower_case,\n      len_title=FLAGS.len_title,\n      len_passage=FLAGS.len_passage,\n      max_num_articles=FLAGS.max_num_articles,\n      include_article_title_in_passage=FLAGS.include_article_title_in_passage,\n      include_text_snippet_in_example=True)\n  print(\"Loading crawled articles...\")\n  num_articles = data_processor.read_crawled_articles(FLAGS.crawled_articles)\n  print(\"Total number of articles loaded: %d\" % num_articles)\n  print()\n  transform_as_tfrecords(data_processor, \"train\")\n  transform_as_tfrecords(data_processor, \"valid\")\n  transform_as_tfrecords(data_processor, \"test\")\n\n\nif __name__ == \"__main__\":","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/nhnet/raw_data_process.py#L54-L90","documentation":"Error \"vocab must be set as the filepath of BERT vocabulary.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/nhnet/raw_data_process.py:72 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"}