keras-team/keras · error · ValueError
lora is already enabled. This can only be done once per laye
Error message
lora is already enabled. This can only be done once per layer.
What it means
Error "lora is already enabled. This can only be done once per layer." thrown in keras-team/keras.
Source
Thrown at keras/src/layers/core/embedding.py:232
def enable_lora(
self,
rank,
lora_alpha=None,
a_initializer="he_uniform",
b_initializer="zeros",
):
if self.embeddings_constraint:
raise ValueError(
"Lora is incompatible with embedding constraints. "
"In order to enable lora on this layer, remove the "
"`embeddings_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 embedding while maintaining the original embedding's dtype.
self.lora_embeddings_a = self.add_weight(
name="lora_embeddings_a",
shape=(self.input_dim, rank),
initializer=initializers.get(a_initializer),
dtype="float32",
regularizer=self.embeddings_regularizer,
)
self.lora_embeddings_b = self.add_weight(
name="lora_embeddings_b",
shape=(rank, self.output_dim),View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/layers/core/embedding.py:232 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/fe46a68791bedfb4.
Report an issue: GitHub.