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
27f8e6b9
"model/git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "33801c1597edca5dd04c5de117db89b5bc27f43a"
Unverified
Commit
27f8e6b9
authored
Apr 08, 2025
by
huangtingwei
Committed by
GitHub
Apr 07, 2025
Browse files
fix multimodal hash feature (#5083)
parent
afb752bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
python/sglang/srt/managers/schedule_batch.py
python/sglang/srt/managers/schedule_batch.py
+7
-0
No files found.
python/sglang/srt/managers/schedule_batch.py
View file @
27f8e6b9
...
@@ -198,8 +198,15 @@ class MultimodalDataItem:
...
@@ -198,8 +198,15 @@ class MultimodalDataItem:
Set the pad value after first hashign the data
Set the pad value after first hashign the data
"""
"""
def
tensor_hash
(
f
):
f_list
=
flatten_nested_list
(
f
)
f_cat
=
torch
.
concat
(
f_list
).
contiguous
().
numpy
().
tobytes
()
return
hash
(
f_cat
)
def
hash_feature
(
f
):
def
hash_feature
(
f
):
if
isinstance
(
f
,
list
):
if
isinstance
(
f
,
list
):
if
isinstance
(
f
[
0
],
torch
.
Tensor
):
return
tensor_hash
(
f
)
return
hash
(
tuple
(
flatten_nested_list
(
f
)))
return
hash
(
tuple
(
flatten_nested_list
(
f
)))
elif
isinstance
(
f
,
np
.
ndarray
):
elif
isinstance
(
f
,
np
.
ndarray
):
arr
=
np
.
ascontiguousarray
(
f
)
arr
=
np
.
ascontiguousarray
(
f
)
...
...
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