tensorflow/models · error · ValueError
Inside a program, we should not bind the config with a class
Error message
Inside a program, we should not bind the config with a class twice.
What it means
Error "Inside a program, we should not bind the config with a class twice." thrown in tensorflow/models.
Source
Thrown at official/modeling/hyperparams/base_config.py:43
from absl import logging
import tensorflow as tf, tf_keras
import yaml
from official.modeling.hyperparams import params_dict
_BOUND = set()
def bind(config_cls):
"""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):View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/modeling/hyperparams/base_config.py:43 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/a64decc66f6c4093.
Report an issue: GitHub.