{"record":{"id":"fe46a68791bedfb4","repo":"keras-team/keras","slug":"lora-is-already-enabled-this-can-only-be-done-onc-fe46a6","errorCode":null,"errorMessage":"lora is already enabled. This can only be done once per layer.","messagePattern":"lora is already enabled\\. This can only be done once per layer\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/core/embedding.py","lineNumber":232,"sourceCode":"    def enable_lora(\n        self,\n        rank,\n        lora_alpha=None,\n        a_initializer=\"he_uniform\",\n        b_initializer=\"zeros\",\n    ):\n        if self.embeddings_constraint:\n            raise ValueError(\n                \"Lora is incompatible with embedding constraints. \"\n                \"In order to enable lora on this layer, remove the \"\n                \"`embeddings_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 embedding while maintaining the original embedding's dtype.\n        self.lora_embeddings_a = self.add_weight(\n            name=\"lora_embeddings_a\",\n            shape=(self.input_dim, rank),\n            initializer=initializers.get(a_initializer),\n            dtype=\"float32\",\n            regularizer=self.embeddings_regularizer,\n        )\n        self.lora_embeddings_b = self.add_weight(\n            name=\"lora_embeddings_b\",\n            shape=(rank, self.output_dim),","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/core/embedding.py#L214-L250","documentation":"Error \"lora is already enabled. This can only be done once per layer.\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/layers/core/embedding.py:232 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"}