{"record":{"id":"63eeb6ffea6f1dcb","repo":"tensorflow/models","slug":"must-specify-exactly-one-of-vocab-file-with-match-63eeb6","errorCode":null,"errorMessage":"Must specify exactly one of vocab_file (with matching lower_case flag) or preprocessing_hub_module_url.","messagePattern":"Must specify exactly one of vocab_file \\(with matching lower_case flag\\) or preprocessing_hub_module_url\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/data/sentence_prediction_dataloader.py","lineNumber":212,"sourceCode":"    ]\n    return self._pack_inputs(segments)\n\n\n@data_loader_factory.register_data_loader_cls(SentencePredictionTextDataConfig)\nclass SentencePredictionTextDataLoader(data_loader.DataLoader):\n  \"\"\"Loads dataset with raw text for sentence prediction task.\"\"\"\n\n  def __init__(self, params):\n    if bool(params.tfds_name) != bool(params.tfds_split):\n      raise ValueError('`tfds_name` and `tfds_split` should be specified or '\n                       'unspecified at the same time.')\n    if bool(params.tfds_name) == bool(params.input_path):\n      raise ValueError('Must specify either `tfds_name` and `tfds_split` '\n                       'or `input_path`.')\n    if not params.text_fields:\n      raise ValueError('Unexpected empty text fields.')\n    if bool(params.vocab_file) == bool(params.preprocessing_hub_module_url):\n      raise ValueError('Must specify exactly one of vocab_file (with matching '\n                       'lower_case flag) or preprocessing_hub_module_url.')\n\n    self._params = params\n    self._text_fields = params.text_fields\n    self._label_field = params.label_field\n    self._label_type = params.label_type\n    self._include_example_id = params.include_example_id\n    self._text_processor = TextProcessor(\n        seq_length=params.seq_length,\n        vocab_file=params.vocab_file,\n        tokenization=params.tokenization,\n        lower_case=params.lower_case,\n        preprocessing_hub_module_url=params.preprocessing_hub_module_url)\n\n  def _bert_preprocess(self, record: Mapping[str, tf.Tensor]):\n    \"\"\"Berts preprocess.\"\"\"\n    segments = [record[x] for x in self._text_fields]\n    model_inputs = self._text_processor(segments)","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/data/sentence_prediction_dataloader.py#L194-L230","documentation":"Error \"Must specify exactly one of vocab_file (with matching lower_case flag) or preprocessing_hub_module_url.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/data/sentence_prediction_dataloader.py:212 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"}