{"record":{"id":"9a61216c4e0c4f59","repo":"tensorflow/models","slug":"you-must-specify-a-temporary-directory-either-in","errorCode":null,"errorMessage":"You must specify a temporary directory, either in params.input_preprocessed_data_path or logging_dir to store intermediate evaluation TFRecord data.","messagePattern":"You must specify a temporary directory, either in params\\.input_preprocessed_data_path or logging_dir to store intermediate evaluation TFRecord data\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/tasks/question_answering.py","lineNumber":140,"sourceCode":"    start_loss = tf_keras.losses.sparse_categorical_crossentropy(\n        start_positions,\n        tf.cast(start_logits, dtype=tf.float32),\n        from_logits=True)\n    end_loss = tf_keras.losses.sparse_categorical_crossentropy(\n        end_positions, tf.cast(end_logits, dtype=tf.float32), from_logits=True)\n\n    loss = (tf.reduce_mean(start_loss) + tf.reduce_mean(end_loss)) / 2\n    return loss\n\n  def _preprocess_eval_data(self, params):\n    eval_examples = self.squad_lib.read_squad_examples(\n        input_file=params.input_path,\n        is_training=False,\n        version_2_with_negative=params.version_2_with_negative)\n\n    temp_file_path = params.input_preprocessed_data_path or self.logging_dir\n    if not temp_file_path:\n      raise ValueError('You must specify a temporary directory, either in '\n                       'params.input_preprocessed_data_path or logging_dir to '\n                       'store intermediate evaluation TFRecord data.')\n    eval_writer = self.squad_lib.FeatureWriter(\n        filename=os.path.join(temp_file_path, 'eval.tf_record'),\n        is_training=False)\n    eval_features = []\n\n    def _append_feature(feature, is_padding):\n      if not is_padding:\n        eval_features.append(feature)\n      eval_writer.process_feature(feature)\n\n    # XLNet preprocesses SQuAD examples in a P, Q, class order whereas\n    # BERT preprocesses in a class, Q, P order.\n    xlnet_ordering = self.task_config.model.encoder.type == 'xlnet'\n    kwargs = dict(\n        examples=eval_examples,\n        max_seq_length=params.seq_length,","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/tasks/question_answering.py#L122-L158","documentation":"Error \"You must specify a temporary directory, either in params.input_preprocessed_data_path or logging_dir to store intermediate evaluation TFRecord data.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/tasks/question_answering.py:140 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"}