tensorflow/models · error · ValueError

`steps` ({steps}) should be > 0, or == -1.

Error message

`steps` ({steps}) should be > 0, or == -1.

What it means

Error "`steps` ({steps}) should be > 0, or == -1." thrown in tensorflow/models.

Source

Thrown at orbit/controller.py:318

        until the underlying dataset is exhausted. Support for this is dependent
        on the specific `evaluator` being used.

    Returns:
      The evaluation results as a dictionary mapping names to NumPy values.

    Raises:
      ValueError: If `evaluator` was not provided to `Controller.__init__`.
      ValueError: If no checkpoint is present in `checkpoint_manager.directory`.
      ValueError: If `steps` is not a positive value or -1.
    """
    self._require("evaluator", for_method="evaluate")

    if steps > 0:
      steps_msg = f"running {steps} steps of evaluation..."
    elif steps == -1:
      steps_msg = "running complete evaluation..."
    else:
      raise ValueError(f"`steps` ({steps}) should be > 0, or == -1.")

    current_step = self.global_step.numpy()
    _log(f" eval | step: {current_step: 6d} | {steps_msg}")

    start = time.time()
    assert isinstance(self.evaluator, runner.AbstractEvaluator)
    with self.eval_summary_manager.summary_writer().as_default():
      steps_tensor = tf.convert_to_tensor(steps, dtype=tf.int32)
      eval_output = self.evaluator.evaluate(steps_tensor)
    elapsed = time.time() - start

    eval_output = eval_output or {}
    for action in self.eval_actions:
      action(eval_output)
    eval_output = tf.nest.map_structure(utils.get_value, eval_output)

    if steps > 0:
      # Only log if steps has been specified.

View on GitHub (pinned to e006f5f0d5)

Solutions

  1. Pass steps > 0, or -1 to run until the dataset is exhausted.
  2. Fix the steps argument passed to train/evaluate.

When it happens

Trigger: Thrown at orbit/controller.py:318 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/7e7f7003c20b2e74. Report an issue: GitHub.