tensorflow/models · error · ValueError
Task not found
Error message
Task not found: %s
What it means
Dispatch guard in preprocess_classification_data.main: the lowercased --task_name matched none of the registered processors (mnli_matched, mnli_mismatched, sts-b, imdb, yelp5). The task name flag is the faulty input.
Solutions
- Use one of the supported task names, e.g. 'mnli_matched', 'sts-b', 'imdb', 'yelp5'
- Register a custom Processor class in the processors dict for a new task
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/legacy/xlnet/preprocess_classification_data.py:400 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/dd6c60cc19cd33c1.
Report an issue: GitHub.
Appendix: source
Thrown at official/legacy/xlnet/preprocess_classification_data.py:400
tf_example = tf.train.Example(features=tf.train.Features(feature=features))
writer.write(tf_example.SerializeToString())
writer.close()
def main(_):
logging.set_verbosity(logging.INFO)
processors = {
"mnli_matched": MnliMatchedProcessor,
"mnli_mismatched": MnliMismatchedProcessor,
"sts-b": StsbProcessor,
"imdb": ImdbProcessor,
"yelp5": Yelp5Processor
}
task_name = FLAGS.task_name.lower()
if task_name not in processors:
raise ValueError("Task not found: %s" % (task_name))
processor = processors[task_name]()
label_list = processor.get_labels() if not FLAGS.is_regression else None
sp = spm.SentencePieceProcessor()
sp.Load(FLAGS.spiece_model_file)
def tokenize_fn(text):
text = preprocess_utils.preprocess_text(text, lower=FLAGS.uncased)
return preprocess_utils.encode_ids(sp, text)
spm_basename = os.path.basename(FLAGS.spiece_model_file)
train_file_base = "{}.len-{}.train.tf_record".format(spm_basename,
FLAGS.max_seq_length)
train_file = os.path.join(FLAGS.output_dir, train_file_base)
logging.info("Use tfrecord file %s", train_file)
View on GitHub (pinned to e006f5f0d5)