Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
cfba042e
Unverified
Commit
cfba042e
authored
Feb 05, 2026
by
KrishnanPrash
Committed by
GitHub
Feb 05, 2026
Browse files
fix: mm_item keys for SGLang API (#5981)
Signed-off-by:
Krishnan Prashanth
<
kprashanth@nvidia.com
>
parent
4c200e79
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
components/src/dynamo/sglang/request_handlers/multimodal/worker_handler.py
...namo/sglang/request_handlers/multimodal/worker_handler.py
+19
-7
No files found.
components/src/dynamo/sglang/request_handlers/multimodal/worker_handler.py
View file @
cfba042e
...
@@ -114,16 +114,28 @@ class EmbeddingsProcessor:
...
@@ -114,16 +114,28 @@ class EmbeddingsProcessor:
def
create_multimodal_item
(
def
create_multimodal_item
(
embeddings
:
torch
.
Tensor
,
request
:
SglangMultimodalRequest
embeddings
:
torch
.
Tensor
,
request
:
SglangMultimodalRequest
)
->
dict
:
)
->
dict
:
"""Create multimodal item for SGLang generation"""
"""
Create multimodal item for SGLang generation.
Uses format="precomputed_embedding" since Dynamo's Encoder has already
run the vision encoder. SGLang expects 2D embeddings (num_patches, hidden_dim).
"""
precomputed
=
embeddings
.
to
(
MultimodalConfig
.
EMBEDDINGS_DTYPE
)
# SGLang expects 2D tensor for precomputed_embedding format
# Encoder outputs 3D (1, num_patches, hidden_dim) for internal consistency
# Squeeze batch dimension at SGLang boundary
if
precomputed
.
dim
()
==
3
and
precomputed
.
shape
[
0
]
==
1
:
precomputed
=
precomputed
.
squeeze
(
0
)
precomputed_embeddings
=
embeddings
.
to
(
MultimodalConfig
.
EMBEDDINGS_DTYPE
)
grid_thw_tensor
=
torch
.
tensor
(
request
.
image_grid_thw
)
grid_thw_tensor
=
torch
.
tensor
(
request
.
image_grid_thw
)
mm_item
=
dict
(
mm_item
=
{
modality
=
"IMAGE"
,
"format"
:
"precomputed_embedding"
,
image_grid_thw
=
grid_thw_tensor
,
"feature"
:
precomputed
,
precomputed_embeddings
=
precomputed_embeddings
,
"image_grid_thw"
:
grid_thw_tensor
,
)
"modality"
:
"IMAGE"
,
}
return
mm_item
return
mm_item
...
...
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