Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
9a7e7a65
"vscode:/vscode.git/clone" did not exist on "67821f95e4ee04f65965eac4ecc1ffacab4302e6"
Unverified
Commit
9a7e7a65
authored
Oct 09, 2025
by
Glen Liu
Committed by
GitHub
Oct 09, 2025
Browse files
[Bug Fix] prevent lora adapter from being loaded into LoRAManager if it is already loaded (#11365)
parent
0fe87213
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
python/sglang/srt/lora/lora_manager.py
python/sglang/srt/lora/lora_manager.py
+9
-0
test/srt/lora/test_lora_update.py
test/srt/lora/test_lora_update.py
+26
-0
No files found.
python/sglang/srt/lora/lora_manager.py
View file @
9a7e7a65
...
@@ -156,6 +156,15 @@ class LoRAManager:
...
@@ -156,6 +156,15 @@ class LoRAManager:
Validate if an adapter can be loaded into the current LoRA memory pool and generate error if it is incompatible.
Validate if an adapter can be loaded into the current LoRA memory pool and generate error if it is incompatible.
"""
"""
# 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"
)
# 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
)
incompatible
=
memory_pool
and
not
memory_pool
.
can_support
(
lora_config
)
incompatible
=
memory_pool
and
not
memory_pool
.
can_support
(
lora_config
)
...
...
test/srt/lora/test_lora_update.py
View file @
9a7e7a65
...
@@ -101,6 +101,19 @@ BASIC_TESTS = [
...
@@ -101,6 +101,19 @@ BASIC_TESTS = [
},
},
],
],
op_sequence
=
[
op_sequence
=
[
Operation
(
type
=
OperationType
.
LOAD
,
data
=
"philschmid/code-llama-3-1-8b-text-to-sql-lora"
,
expected_error
=
"already loaded"
,
),
Operation
(
type
=
OperationType
.
UNLOAD
,
data
=
"philschmid/code-llama-3-1-8b-text-to-sql-lora"
,
),
Operation
(
type
=
OperationType
.
LOAD
,
data
=
"philschmid/code-llama-3-1-8b-text-to-sql-lora"
,
),
Operation
(
Operation
(
type
=
OperationType
.
FORWARD
,
type
=
OperationType
.
FORWARD
,
data
=
create_batch_data
(
data
=
create_batch_data
(
...
@@ -224,6 +237,19 @@ BASIC_TESTS = [
...
@@ -224,6 +237,19 @@ BASIC_TESTS = [
type
=
OperationType
.
LOAD
,
type
=
OperationType
.
LOAD
,
data
=
"pbevan11/llama-3.1-8b-ocr-correction"
,
data
=
"pbevan11/llama-3.1-8b-ocr-correction"
,
),
),
Operation
(
type
=
OperationType
.
LOAD
,
data
=
"philschmid/code-llama-3-1-8b-text-to-sql-lora"
,
expected_error
=
"already loaded"
,
),
Operation
(
type
=
OperationType
.
UNLOAD
,
data
=
"philschmid/code-llama-3-1-8b-text-to-sql-lora"
,
),
Operation
(
type
=
OperationType
.
LOAD
,
data
=
"philschmid/code-llama-3-1-8b-text-to-sql-lora"
,
),
Operation
(
Operation
(
type
=
OperationType
.
FORWARD
,
type
=
OperationType
.
FORWARD
,
data
=
create_batch_data
(
data
=
create_batch_data
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment