Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions python/sglang/srt/lora/lora_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,17 @@ def validate_new_adapter(self, lora_config: LoRAConfig, lora_ref: LoRARef):
"""

# 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)
Expand Down
Loading