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
693723d1
Unverified
Commit
693723d1
authored
Apr 28, 2025
by
Lianmin Zheng
Committed by
GitHub
Apr 28, 2025
Browse files
Revert "Tiny refactor DefaultModelLoader.Source" (#5825)
parent
966eb908
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
python/sglang/srt/model_executor/model_runner.py
python/sglang/srt/model_executor/model_runner.py
+7
-1
python/sglang/srt/model_loader/loader.py
python/sglang/srt/model_loader/loader.py
+6
-10
No files found.
python/sglang/srt/model_executor/model_runner.py
View file @
693723d1
...
@@ -515,7 +515,13 @@ class ModelRunner:
...
@@ -515,7 +515,13 @@ class ModelRunner:
def
get_weight_iter
(
config
):
def
get_weight_iter
(
config
):
iter
=
loader
.
_get_weights_iterator
(
iter
=
loader
.
_get_weights_iterator
(
DefaultModelLoader
.
Source
.
init_new
(
config
,
model
)
DefaultModelLoader
.
Source
(
config
.
model_path
,
revision
=
config
.
revision
,
fall_back_to_pt
=
getattr
(
self
.
model
,
"fall_back_to_pt_during_load"
,
True
),
)
)
)
return
iter
return
iter
...
...
python/sglang/srt/model_loader/loader.py
View file @
693723d1
...
@@ -197,15 +197,6 @@ class DefaultModelLoader(BaseModelLoader):
...
@@ -197,15 +197,6 @@ class DefaultModelLoader(BaseModelLoader):
fall_back_to_pt
:
bool
=
True
fall_back_to_pt
:
bool
=
True
"""Whether .pt weights can be used."""
"""Whether .pt weights can be used."""
@
classmethod
def
init_new
(
cls
,
model_config
:
ModelConfig
,
model
):
return
cls
(
model_config
.
model_path
,
model_config
.
revision
,
prefix
=
""
,
fall_back_to_pt
=
getattr
(
model
,
"fall_back_to_pt_during_load"
,
True
),
)
def
__init__
(
self
,
load_config
:
LoadConfig
):
def
__init__
(
self
,
load_config
:
LoadConfig
):
super
().
__init__
(
load_config
)
super
().
__init__
(
load_config
)
if
load_config
.
model_loader_extra_config
:
if
load_config
.
model_loader_extra_config
:
...
@@ -350,7 +341,12 @@ class DefaultModelLoader(BaseModelLoader):
...
@@ -350,7 +341,12 @@ class DefaultModelLoader(BaseModelLoader):
model
:
nn
.
Module
,
model
:
nn
.
Module
,
)
->
Generator
[
Tuple
[
str
,
torch
.
Tensor
],
None
,
None
]:
)
->
Generator
[
Tuple
[
str
,
torch
.
Tensor
],
None
,
None
]:
primary_weights
=
DefaultModelLoader
.
Source
.
init_new
(
model_config
,
model
)
primary_weights
=
DefaultModelLoader
.
Source
(
model_config
.
model_path
,
model_config
.
revision
,
prefix
=
""
,
fall_back_to_pt
=
getattr
(
model
,
"fall_back_to_pt_during_load"
,
True
),
)
yield
from
self
.
_get_weights_iterator
(
primary_weights
)
yield
from
self
.
_get_weights_iterator
(
primary_weights
)
secondary_weights
=
cast
(
secondary_weights
=
cast
(
...
...
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