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
1361ab9e
Unverified
Commit
1361ab9e
authored
Mar 08, 2025
by
Lianmin Zheng
Committed by
GitHub
Mar 08, 2025
Browse files
Lazily import lora backends (#4225)
parent
5c7dd14b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
+9
-12
python/sglang/srt/lora/backend/__init__.py
python/sglang/srt/lora/backend/__init__.py
+9
-12
No files found.
python/sglang/srt/lora/backend/__init__.py
View file @
1361ab9e
from
.base_backend
import
BaseLoRABackend
from
.flashinfer_backend
import
FlashInferLoRABackend
from
.triton_backend
import
TritonLoRABackend
from
sglang.srt.lora.backend.base_backend
import
BaseLoRABackend
def
get_backend_from_name
(
name
:
str
)
->
BaseLoRABackend
:
"""
Get corresponding backend class from backend's name
"""
backend_mapping
=
{
"triton"
:
TritonLoRABackend
,
"flashinfer"
:
FlashInferLoRABackend
,
}
if
name
==
"triton"
:
from
sglang.srt.lora.backend.triton_backend
import
TritonLoRABackend
if
name
in
backend_mapping
:
return
backend_mapping
[
name
]
return
TritonLoRABackend
elif
name
==
"flashinfer"
:
from
sglang.srt.lora.backend.flashinfer_backend
import
FlashInferLoRABackend
r
aise
Exception
(
f
"No supported lora backend called
{
name
}
. It should be one of
{
list
(
backend_mapping
.
keys
())
}
"
)
r
eturn
FlashInferLoRABackend
else
:
raise
ValueError
(
f
"Invalid backend:
{
name
}
"
)
__all__
=
[
...
...
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