tensorflow/models · error · ValueError
Mode not found: .
Error message
Mode not found: %s.
What it means
Mode-dispatch guard in run_executor: params.mode (filled into %s) matched none of the supported phases ('train', 'eval_and_predict', single-checkpoint 'eval' etc.), so the executor cannot decide what to run. Indicates a misspelled or unsupported mode in the experiment params.
Solutions
- Set mode in the params config to a supported value such as 'train' or 'eval'
- Check for typos like 'evaluation' or wrong casing in the mode field
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/legacy/detection/main.py:172 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/e04d646f11af592f.
Report an issue: GitHub.
Appendix: source
Thrown at official/legacy/detection/main.py:172
min_eval_interval=params.eval.min_eval_interval,
total_steps=params.train.total_steps)
else:
# Run evaluation once for a single checkpoint.
if not checkpoint_path:
raise ValueError('checkpoint_path cannot be empty.')
if tf.io.gfile.isdir(checkpoint_path):
checkpoint_path = tf.train.latest_checkpoint(checkpoint_path)
summary_writer = executor.SummaryWriter(params.model_dir, 'eval')
results, _ = dist_executor.evaluate_checkpoint(
checkpoint_path=checkpoint_path,
eval_input_fn=eval_input_fn,
eval_metric_fn=model_builder.eval_metrics,
summary_writer=summary_writer)
for k, v in results.items():
logging.info('Final eval metric %s: %f', k, v)
return results
else:
raise ValueError('Mode not found: %s.' % mode)
def run(callbacks=None):
"""Runs the experiment."""
keras_utils.set_session_config(enable_xla=FLAGS.enable_xla)
params = config_factory.config_generator(FLAGS.model)
params = params_dict.override_params_dict(
params, FLAGS.config_file, is_strict=True)
params = params_dict.override_params_dict(
params, FLAGS.params_override, is_strict=True)
params.override(
{
'strategy_type': FLAGS.strategy_type,
'model_dir': FLAGS.model_dir,
'strategy_config': executor.strategy_flags_dict(),View on GitHub (pinned to e006f5f0d5)