tensorflow/models · error · ValueError

Smart Bias is only supported currently with alinear warm up.

Error message

Smart Bias is only supported currently with alinear warm up.

What it means

Compatibility guard in OptimizerFactory.get_bias_lr_schedule: smart-bias learning-rate scaling is configured, but the warmup schedule is not linear. The smart-bias implementation only knows how to adjust bias LRs relative to a linear warmup curve; with any other warmup the bias schedule math is undefined, so the factory refuses rather than emitting a wrong schedule.

Solutions

  1. Set the warmup type to 'linear' in the optimizer config when smart bias is enabled
  2. Disable smart bias if a non-linear warmup is required
  3. Check the warmup config fields (type/name) for typos that fall into the non-linear branch
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at official/projects/yolo/optimization/optimizer_factory.py:86 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/dac26e01fc311d77. Report an issue: GitHub.

Appendix: source

Thrown at official/projects/yolo/optimization/optimizer_factory.py:86

    Builds learning rate from config. Learning rate schedule is built according
    to the learning rate config. If learning rate type is consant,
    lr_config.learning_rate is returned.

    Args:
      bias_lr: learning rate config.

    Returns:
      tf_keras.optimizers.schedules.LearningRateSchedule instance. If
      learning rate type is consant, lr_config.learning_rate is returned.
    """
    if self._lr_type == 'constant':
      lr = self._lr_config.learning_rate
    else:
      lr = LR_CLS[self._lr_type](**self._lr_config.as_dict())

    if self._warmup_config:
      if self._warmup_type != 'linear':
        raise ValueError('Smart Bias is only supported currently with a'
                         'linear warm up.')
      warm_up_cfg = self._warmup_config.as_dict()
      warm_up_cfg['warmup_learning_rate'] = bias_lr
      lr = WARMUP_CLS['linear'](lr, **warm_up_cfg)
    return lr

  @gin.configurable
  def add_ema(self, optimizer):
    """Add EMA to the optimizer independently of the build optimizer method."""
    if self._use_ema:
      optimizer = ema_optimizer.ExponentialMovingAverage(
          optimizer, **self._ema_config.as_dict())
    return optimizer

View on GitHub (pinned to e006f5f0d5)