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
49eca14b
Unverified
Commit
49eca14b
authored
Feb 25, 2026
by
zhongdaor-nv
Committed by
GitHub
Feb 25, 2026
Browse files
fix: optimize uuid calculation (#6596)
Signed-off-by:
zhongdaor
<
zhongdaor@nvidia.com
>
parent
a6d970e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
20 deletions
+8
-20
components/src/dynamo/vllm/multimodal_utils/hash_utils.py
components/src/dynamo/vllm/multimodal_utils/hash_utils.py
+7
-20
pyproject.toml
pyproject.toml
+1
-0
No files found.
components/src/dynamo/vllm/multimodal_utils/hash_utils.py
View file @
49eca14b
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
import
hashlib
import
io
import
logging
from
typing
import
Any
,
Sequence
import
blake3
import
numpy
as
np
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -16,32 +17,18 @@ def image_to_bytes(img: Any) -> bytes:
if
isinstance
(
img
,
bytes
):
return
img
if
isinstance
(
img
,
Image
.
Image
):
buf
=
io
.
BytesIO
()
img
.
save
(
buf
,
format
=
"PNG"
)
return
buf
.
getvalue
()
# Frontend-decoding can provide image tensors as numpy arrays.
try
:
import
numpy
as
np
if
isinstance
(
img
,
np
.
ndarray
):
pil_img
=
Image
.
fromarray
(
img
)
buf
=
io
.
BytesIO
()
pil_img
.
save
(
buf
,
format
=
"PNG"
)
return
buf
.
getvalue
()
except
ImportError
:
pass
if
isinstance
(
img
,
Image
.
Image
|
np
.
ndarray
):
return
img
.
tobytes
()
raise
TypeError
(
f
"Unsupported image type for hashing:
{
type
(
img
)
}
"
)
def
compute_mm_uuids_from_images
(
images
:
Sequence
[
Any
])
->
list
[
str
]:
"""
Compute
SHA256
hex UUIDs for image inputs.
Compute
blake3
hex UUIDs for image inputs.
"""
uuids
:
list
[
str
]
=
[]
for
img
in
images
:
raw_bytes
=
image_to_bytes
(
img
)
uuids
.
append
(
hashlib
.
sha256
(
raw_bytes
).
hexdigest
())
uuids
.
append
(
blake3
.
blake3
(
raw_bytes
).
hexdigest
())
return
uuids
pyproject.toml
View file @
49eca14b
...
...
@@ -59,6 +59,7 @@ vllm = [
"nixl[cu12]<=0.9.0"
,
"vllm[flashinfer,runai]==0.15.1"
,
"vllm-omni==0.14.0"
,
"blake3>=1.0.0,<2.0.0"
,
]
sglang
=
[
...
...
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