tensorflow/models · error · AttributeError

The trainer requires the configuration contains an attribute

Error message

The trainer requires the configuration contains an attribute `task.train_data`.

What it means

Error "The trainer requires the configuration contains an attribute `task.train_data`." thrown in tensorflow/models.

Source

Thrown at official/core/base_trainer.py:268

    \task
      \train_data
      \validation_data

    Args:
      config: a namedtuple, dataclass, ConfigDict, etc.
      check_train_data: whether to check task.train_data field.
      check_validation_data: whether to check task.validation_data field.
    """
    if not hasattr(config, "trainer"):
      raise AttributeError("The trainer requires the configuration contains an"
                           " attribute `trainer`.")

    if not hasattr(config, "task"):
      raise AttributeError("The trainer requires the configuration contains an"
                           " attribute `task`.")

    if check_train_data and not hasattr(config.task, "train_data"):
      raise AttributeError("The trainer requires the configuration contains an"
                           " attribute `task.train_data`.")

    if check_validation_data and not hasattr(config.task, "validation_data"):
      raise AttributeError("The trainer requires the configuration contains an"
                           " attribute `task.validation_data`.")

  @property
  def strategy(self):
    return self._strategy

  @property
  def config(self):
    return self._config

  @property
  def task(self):
    return self._task

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/core/base_trainer.py:268 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/01628d8380eb8acb. Report an issue: GitHub.