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
de28f8e7
Unverified
Commit
de28f8e7
authored
Sep 17, 2025
by
Kevin Xiang Li
Committed by
GitHub
Sep 17, 2025
Browse files
vlm: remove redundant d2h movement of mm feature tensors (#9987)
Co-authored-by:
Xiang (Kevin) Li
<
lik@nvidia.com
>
parent
56405076
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
python/sglang/srt/multimodal/processors/base_processor.py
python/sglang/srt/multimodal/processors/base_processor.py
+7
-6
python/sglang/srt/server_args.py
python/sglang/srt/server_args.py
+6
-0
No files found.
python/sglang/srt/multimodal/processors/base_processor.py
View file @
de28f8e7
...
...
@@ -241,12 +241,13 @@ class BaseMultimodalProcessor(ABC):
return_tensors
=
"pt"
,
**
kwargs
,
)
# move feature tensors to cpu
for
feature_name
in
self
.
FEATURE_NAMES
:
if
feature_name
in
result
and
isinstance
(
result
[
feature_name
],
torch
.
Tensor
):
result
[
feature_name
]
=
result
[
feature_name
].
to
(
"cpu"
)
if
not
self
.
server_args
.
keep_mm_feature_on_device
:
# move feature tensors to cpu
for
feature_name
in
self
.
FEATURE_NAMES
:
if
feature_name
in
result
and
isinstance
(
result
[
feature_name
],
torch
.
Tensor
):
result
[
feature_name
]
=
result
[
feature_name
].
to
(
"cpu"
)
return
result
...
...
python/sglang/srt/server_args.py
View file @
de28f8e7
...
...
@@ -381,6 +381,7 @@ class ServerArgs:
disable_shared_experts_fusion
:
bool
=
False
disable_chunked_prefix_cache
:
bool
=
False
disable_fast_image_processor
:
bool
=
False
keep_mm_feature_on_device
:
bool
=
False
enable_return_hidden_states
:
bool
=
False
scheduler_recv_interval
:
int
=
1
numa_node
:
Optional
[
List
[
int
]]
=
None
...
...
@@ -2213,6 +2214,11 @@ class ServerArgs:
action
=
"store_true"
,
help
=
"Adopt base image processor instead of fast image processor."
,
)
parser
.
add_argument
(
"--keep-mm-feature-on-device"
,
action
=
"store_true"
,
help
=
"Keep multimodal feature tensors on device after processing to save D2H copy."
,
)
parser
.
add_argument
(
"--enable-return-hidden-states"
,
action
=
"store_true"
,
...
...
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