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

This commit is contained in:
Glen Liu
2025-11-24 15:16:41 -08:00
committed by GitHub
parent bf10869203
commit eb1d885400
+11 -7
View File
@@ -155,13 +155,17 @@ class LoRAManager:
""" """
# Check if this LoRA adapter is already loaded # Check if this LoRA adapter is already loaded
if any( for existing_lora_ref in self.lora_refs.values():
lora_ref.lora_name == existing_lora_ref.lora_name if 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"
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. # Check if the LoRA adapter shape is compatible with the current LoRA memory pool configuration.
memory_pool = getattr(self, "memory_pool", None) memory_pool = getattr(self, "memory_pool", None)