tensorflow/models · error · ValueError

The `BUILDER` type is not supported: {builder}

Error message

The `BUILDER` type is not supported: {builder}

What it means

Error "The `BUILDER` type is not supported: {builder}" thrown in tensorflow/models.

Source

Thrown at official/modeling/hyperparams/base_config.py:54

  """Bind a class to config cls."""
  if not inspect.isclass(config_cls):
    raise ValueError('The bind decorator is supposed to apply on the class '
                     f'attribute. Received {config_cls}, not a class.')

  def decorator(builder):
    if config_cls in _BOUND:
      raise ValueError('Inside a program, we should not bind the config with a'
                       ' class twice.')
    if inspect.isclass(builder):
      config_cls._BUILDER = builder  # pylint: disable=protected-access
    elif inspect.isfunction(builder):

      def _wrapper(self, *args, **kwargs):  # pylint: disable=unused-argument
        return builder(*args, **kwargs)

      config_cls._BUILDER = _wrapper  # pylint: disable=protected-access
    else:
      raise ValueError(f'The `BUILDER` type is not supported: {builder}')
    _BOUND.add(config_cls)
    return builder

  return decorator


def _is_optional(field):
  # Two styles of annotating optional fields:
  #   Optional[T] -> typing.Union
  #   T | None    -> types.UnionType
  is_union = typing.get_origin(field) in (Union, types.UnionType)
  # An optional field is a union of a type, and NoneType.
  args = typing.get_args(field)
  return is_union and len(args) == 2 and type(None) in args


@dataclasses.dataclass
class Config(params_dict.ParamsDict):

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/modeling/hyperparams/base_config.py:54 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/74a37a0baadef4e2. Report an issue: GitHub.