tensorflow/models · error · ValueError

`{attribute}` is not set. Pass `{attribute}` to `Controller.

Error message

`{attribute}` is not set. Pass `{attribute}` to `Controller.__init__` before calling `{for_method}()`.

What it means

Error "`{attribute}` is not set. Pass `{attribute}` to `Controller.__init__` before calling `{for_method}()`." thrown in tensorflow/models.

Source

Thrown at orbit/controller.py:572

        was provided to `Controller.__init__`.

    Returns:
      A boolean indicating whether a checkpoint was saved.
    """
    if self.checkpoint_manager and self.checkpoint_manager.checkpoint_interval:
      ckpt_path = self.checkpoint_manager.save(
          checkpoint_number=self.global_step.numpy(),
          check_interval=check_interval,
          options=self._checkpoint_options)
      if ckpt_path is not None:
        _log(f"saved checkpoint to {ckpt_path}.")
        return True
    return False

  def _require(self, attribute, for_method):
    """Utility method to raise an error if the given `attribute` is not set."""
    if getattr(self, attribute, None) is None:
      raise ValueError(
          f"`{attribute}` is not set. Pass `{attribute}` to "
          f"`Controller.__init__` before calling `{for_method}()`.")

  def _sync_on_async_checkpointing(self):
    """Force to wait for the async checkpoint saving (if any) to finish."""
    # pylint: disable=protected-access
    if self.checkpoint_manager:
      logging.info("Sync on async checkpoint saving.")
      self.checkpoint_manager.sync()


class StepTimer:
  """Utility class for measuring steps/second."""

  def __init__(self, step):
    self.step = step
    self.start()

View on GitHub (pinned to e006f5f0d5)

Solutions

  1. Pass the named attribute to Controller.__init__ before calling the method.
  2. Call the method that matches the components you provided (train vs evaluate).

When it happens

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