huggingface/pytorch-image-models · error · ValueError

Invalid alpha value: {}

Error message

Invalid alpha value: {}

What it means

RMSpropTF constructor validation: the alpha (smoothing constant, PyTorch's rmsprop alpha) must satisfy 0.0 <= alpha. Negative alpha is rejected because it scales the running square average.

Source

Thrown at timm/optim/rmsprop_tf.py:71

            self,
            params: ParamsT,
            lr: float = 1e-2,
            alpha: float = 0.9,
            eps: float = 1e-10,
            weight_decay: float = 0,
            momentum: float = 0.,
            centered: bool = False,
            decoupled_decay: bool = False,
            corrected_weight_decay: bool = False,
            lr_in_momentum: bool = True,
            caution: bool = False,
    ):
        _validate_scalar("learning rate", lr)
        _validate_scalar("epsilon", eps)
        _validate_scalar("momentum", momentum)
        _validate_scalar("weight_decay", weight_decay)
        if not 0.0 <= alpha:
            raise ValueError("Invalid alpha value: {}".format(alpha))

        defaults = dict(
            lr=lr,
            momentum=momentum,
            alpha=alpha,
            eps=eps,
            centered=centered,
            weight_decay=weight_decay,
            decoupled_decay=decoupled_decay,
            corrected_weight_decay=corrected_weight_decay,
            lr_in_momentum=lr_in_momentum,
            caution=caution,
        )
        super(RMSpropTF, self).__init__(params, defaults)

    def __setstate__(self, state):
        super(RMSpropTF, self).__setstate__(state)
        for group in self.param_groups:

View on GitHub (pinned to 9a5261e31b)

Solutions

  1. Use alpha=0.99 (the TF-style default) or omit it
  2. Validate hyperparameters parsed from configs before optimizer creation

Example fix

# before
opt = RMSpropTF(model.parameters(), alpha=-0.99)

# after
opt = RMSpropTF(model.parameters(), alpha=0.99)
Defensive patterns

Strategy: validation

Validate before calling

assert alpha >= 0.0

Prevention

When it happens

Trigger: Calling timm.optim.RMSpropTF(params, alpha=-0.99) or any negative alpha value.

Common situations: Translating TensorFlow RMSprop hyperparameters (where alpha=0.99 is typical) with a sign mistake, or config typos.

Related errors


AI-assisted analysis of huggingface/pytorch-image-models@9a5261e31b (2026-08-27). Data as JSON: /api/errors/8231beb6e0bf4040. Report an issue: GitHub.