tensorflow/models · error · ValueError

Stateful eval loop is not supported in async training.

Error message

Stateful eval loop is not supported in async training.

What it means

Error "Stateful eval loop is not supported in async training." thrown in tensorflow/models.

Source

Thrown at official/core/base_trainer.py:84

    train_loop_fn = super().create_train_loop_fn()
    if getattr(self, "_is_async", False):

      def _async_loop_fn(iterator, num_steps):
        self.coordinator_for_async().schedule(
            train_loop_fn, args=(iterator, num_steps)
        )

      return _async_loop_fn
    else:
      return train_loop_fn

  def create_eval_loop_fn(self, has_state: bool):
    """Creates a training loop from the given step function and options."""
    eval_loop_fn = super().create_eval_loop_fn(has_state)

    if getattr(self, "_is_async", False):
      if has_state:
        raise ValueError(
            "Stateful eval loop is not supported in async training.")

      def _async_loop_fn(iterator, num_steps, state=None, reduce_fn=None):
        assert state is None
        assert reduce_fn is None
        self.coordinator_for_async().schedule(
            eval_loop_fn, args=(iterator, num_steps)
        )

      return _async_loop_fn
    else:
      return eval_loop_fn

  def distribute_dataset(self, dataset_or_fn, *args, **kwargs):
    """A utility function to help create a `tf.distribute.DistributedDataset`.

    Args:
      dataset_or_fn: A instance of `tf.data.Dataset`, or a "dataset function"

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/core/base_trainer.py:84 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/3af205adec35501e. Report an issue: GitHub.