{"record":{"id":"f73f828eccd96bf6","repo":"keras-team/keras","slug":"lora-is-incompatible-with-kernel-constraints-in-o","errorCode":null,"errorMessage":"Lora is incompatible with kernel constraints. In order to enable lora on this layer, remove the `kernel_constraint` argument.","messagePattern":"Lora is incompatible with kernel constraints\\. In order to enable lora on this layer, remove the `kernel_constraint` argument\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/convolutional/base_conv.py","lineNumber":288,"sourceCode":"        return compute_conv_output_shape(\n            input_shape,\n            self.filters,\n            self.kernel_size,\n            strides=self.strides,\n            padding=self.padding,\n            data_format=self.data_format,\n            dilation_rate=self.dilation_rate,\n        )\n\n    def enable_lora(\n        self,\n        rank,\n        lora_alpha=None,\n        a_initializer=\"he_uniform\",\n        b_initializer=\"zeros\",\n    ):\n        if self.kernel_constraint:\n            raise ValueError(\n                \"Lora is incompatible with kernel constraints. \"\n                \"In order to enable lora on this layer, remove the \"\n                \"`kernel_constraint` argument.\"\n            )\n        if not self.built:\n            raise ValueError(\n                \"Cannot enable lora on a layer that isn't yet built.\"\n            )\n        if self.lora_enabled:\n            raise ValueError(\n                \"lora is already enabled. This can only be done once per layer.\"\n            )\n        self._tracker.unlock()\n\n        # LoRA weights should be float32 to avoid the risk of underflow or\n        # overflow during fine-tuning.\n        # When deploying the model, these weights should be merged with the\n        # original kernel while maintaining the original kernel's dtype.","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/convolutional/base_conv.py#L270-L306","documentation":"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.","triggerScenarios":"Thrown at keras/src/layers/convolutional/base_conv.py:288 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}