tensorflow/models · error · ValueError
You must specify a temporary directory, either in params.inp
Error message
You must specify a temporary directory, either in params.input_preprocessed_data_path or logging_dir to store intermediate evaluation TFRecord data.
What it means
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.
Source
Thrown at official/nlp/tasks/question_answering.py:140
start_loss = tf_keras.losses.sparse_categorical_crossentropy(
start_positions,
tf.cast(start_logits, dtype=tf.float32),
from_logits=True)
end_loss = tf_keras.losses.sparse_categorical_crossentropy(
end_positions, tf.cast(end_logits, dtype=tf.float32), from_logits=True)
loss = (tf.reduce_mean(start_loss) + tf.reduce_mean(end_loss)) / 2
return loss
def _preprocess_eval_data(self, params):
eval_examples = self.squad_lib.read_squad_examples(
input_file=params.input_path,
is_training=False,
version_2_with_negative=params.version_2_with_negative)
temp_file_path = params.input_preprocessed_data_path or self.logging_dir
if not temp_file_path:
raise ValueError('You must specify a temporary directory, either in '
'params.input_preprocessed_data_path or logging_dir to '
'store intermediate evaluation TFRecord data.')
eval_writer = self.squad_lib.FeatureWriter(
filename=os.path.join(temp_file_path, 'eval.tf_record'),
is_training=False)
eval_features = []
def _append_feature(feature, is_padding):
if not is_padding:
eval_features.append(feature)
eval_writer.process_feature(feature)
# XLNet preprocesses SQuAD examples in a P, Q, class order whereas
# BERT preprocesses in a class, Q, P order.
xlnet_ordering = self.task_config.model.encoder.type == 'xlnet'
kwargs = dict(
examples=eval_examples,
max_seq_length=params.seq_length,View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/nlp/tasks/question_answering.py:140 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/9a61216c4e0c4f59.
Report an issue: GitHub.