mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-11 13:55:01 +08:00
[Core][Multimodal] Convert PIL Image to array without data copy when hashing (#18682)
Signed-off-by: Lukas Geiger <lukas.geiger94@gmail.com>
This commit is contained in:
parent
57fd13a707
commit
6071e989df
@ -36,8 +36,8 @@ class MultiModalHasher:
|
||||
return np.array(obj).tobytes()
|
||||
|
||||
if isinstance(obj, Image.Image):
|
||||
return cls.item_to_bytes("image",
|
||||
np.array(convert_image_mode(obj, "RGBA")))
|
||||
return cls.item_to_bytes(
|
||||
"image", np.asarray(convert_image_mode(obj, "RGBA")))
|
||||
if isinstance(obj, torch.Tensor):
|
||||
return cls.item_to_bytes("tensor", obj.numpy())
|
||||
if isinstance(obj, np.ndarray):
|
||||
|
||||
@ -164,7 +164,7 @@ class VideoMediaIO(MediaIO[npt.NDArray]):
|
||||
)
|
||||
|
||||
return np.stack([
|
||||
np.array(load_frame(frame_data))
|
||||
np.asarray(load_frame(frame_data))
|
||||
for frame_data in data.split(",")
|
||||
])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user