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
92e2d74f
"git@developer.sourcefind.cn:change/sglang.git" did not exist on "323bc2f51a701737a05e883f3374ec0c91c7eab9"
Unverified
Commit
92e2d74f
authored
Mar 13, 2024
by
Qubitium
Committed by
GitHub
Mar 13, 2024
Browse files
Fix env (docker) compat due to __file__ usage (#288)
parent
d9b3b018
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
python/sglang/srt/managers/router/model_runner.py
python/sglang/srt/managers/router/model_runner.py
+7
-4
No files found.
python/sglang/srt/managers/router/model_runner.py
View file @
92e2d74f
...
@@ -4,6 +4,7 @@ import inspect
...
@@ -4,6 +4,7 @@ import inspect
from
dataclasses
import
dataclass
from
dataclasses
import
dataclass
from
functools
import
lru_cache
from
functools
import
lru_cache
from
pathlib
import
Path
from
pathlib
import
Path
import
importlib.resources
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
...
@@ -31,10 +32,12 @@ global_server_args_dict: dict = None
...
@@ -31,10 +32,12 @@ global_server_args_dict: dict = None
@
lru_cache
()
@
lru_cache
()
def
import_model_classes
():
def
import_model_classes
():
model_arch_name_to_cls
=
{}
model_arch_name_to_cls
=
{}
for
module_path
in
(
Path
(
sglang
.
__file__
).
parent
/
"srt"
/
"models"
).
glob
(
"*.py"
):
for
f
in
importlib
.
resources
.
files
(
"sglang.srt.models"
).
iterdir
():
module
=
importlib
.
import_module
(
f
"sglang.srt.models.
{
module_path
.
stem
}
"
)
if
f
.
name
.
endswith
(
".py"
):
if
hasattr
(
module
,
"EntryClass"
):
module_name
=
Path
(
f
.
name
).
with_suffix
(
''
)
model_arch_name_to_cls
[
module
.
EntryClass
.
__name__
]
=
module
.
EntryClass
module
=
importlib
.
import_module
(
f
"sglang.srt.models.
{
module_name
}
"
)
if
hasattr
(
module
,
"EntryClass"
):
model_arch_name_to_cls
[
module
.
EntryClass
.
__name__
]
=
module
.
EntryClass
return
model_arch_name_to_cls
return
model_arch_name_to_cls
...
...
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