keras-team/keras · error · ValueError

Lora is incompatible with kernel constraints. In order to en

Error message

Lora is incompatible with kernel constraints. In order to enable lora on this layer, remove the `kernel_constraint` argument.

What it means

Error "Lora is incompatible with kernel constraints. In order to enable lora on this layer, remove the `kernel_constraint` argument." thrown in keras-team/keras.

Source

Thrown at keras/src/layers/convolutional/base_conv.py:288

        return compute_conv_output_shape(
            input_shape,
            self.filters,
            self.kernel_size,
            strides=self.strides,
            padding=self.padding,
            data_format=self.data_format,
            dilation_rate=self.dilation_rate,
        )

    def enable_lora(
        self,
        rank,
        lora_alpha=None,
        a_initializer="he_uniform",
        b_initializer="zeros",
    ):
        if self.kernel_constraint:
            raise ValueError(
                "Lora is incompatible with kernel constraints. "
                "In order to enable lora on this layer, remove the "
                "`kernel_constraint` argument."
            )
        if not self.built:
            raise ValueError(
                "Cannot enable lora on a layer that isn't yet built."
            )
        if self.lora_enabled:
            raise ValueError(
                "lora is already enabled. This can only be done once per layer."
            )
        self._tracker.unlock()

        # LoRA weights should be float32 to avoid the risk of underflow or
        # overflow during fine-tuning.
        # When deploying the model, these weights should be merged with the
        # original kernel while maintaining the original kernel's dtype.

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/layers/convolutional/base_conv.py:288 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25). Data as JSON: /api/errors/f73f828eccd96bf6. Report an issue: GitHub.