@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 6071e989df
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 08:30 UTC

[Core][Multimodal] Convert PIL Image to array without data copy when hashing (#18682)

Signed-off-by: Lukas Geiger <lukas.geiger94@gmail.com>

Lukas Geiger committed May 25, 2025 at 18:33 UTC 6071e989df1531b59ef35568f83f7351afb0b51e
2 files changed +3 -3
vllm/multimodal/hasher.py
+2 -2
@@ -36,8 +36,8 @@ class MultiModalHasher:
36 return np.array(obj).tobytes()
37
38 if isinstance(obj, Image.Image):
39 - return cls.item_to_bytes("image",
40 - np.array(convert_image_mode(obj, "RGBA")))
39 + return cls.item_to_bytes(
40 + "image", np.asarray(convert_image_mode(obj, "RGBA")))
41 if isinstance(obj, torch.Tensor):
42 return cls.item_to_bytes("tensor", obj.numpy())
43 if isinstance(obj, np.ndarray):
vllm/multimodal/video.py
+1 -1
@@ -164,7 +164,7 @@ class VideoMediaIO(MediaIO[npt.NDArray]):
164 )
165
166 return np.stack([
167 - np.array(load_frame(frame_data))
167 + np.asarray(load_frame(frame_data))
168 for frame_data in data.split(",")
169 ])
170