add LoRA warning if loading a preexisting LoRA adapter with a different name (#13822)

This commit is contained in:
Glen Liu
2025-11-24 18:16:41 -05:00
committed by GitHub
parent bf10869203
commit eb1d885400

View File

@@ -155,13 +155,17 @@ class LoRAManager:
"""
# Check if this LoRA adapter is already loaded
if any(
lora_ref.lora_name == existing_lora_ref.lora_name
for existing_lora_ref in self.lora_refs.values()
):
raise ValueError(
f"Failed to load LoRA adapter {lora_ref.lora_name} because it is already loaded"
)
for existing_lora_ref in self.lora_refs.values():
if lora_ref.lora_name == existing_lora_ref.lora_name:
raise ValueError(
f"Failed to load LoRA adapter {lora_ref.lora_name} because it is already loaded"
)
if lora_ref.lora_path == existing_lora_ref.lora_path:
logger.warning(
f"{lora_ref.lora_path} is already loaded with name: {existing_lora_ref.lora_name}, "
f"but another copy is being loaded with name: {lora_ref.lora_name}"
)
# Check if the LoRA adapter shape is compatible with the current LoRA memory pool configuration.
memory_pool = getattr(self, "memory_pool", None)