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
[Bugfix] Ensure tensors are contiguous during serialisation (#18860)
Signed-off-by: Lukas Geiger <lukas.geiger94@gmail.com>
Lukas Geiger committed
May 29, 2025 at 11:05 UTC
0b1447f890087c7610b1855ae12de023a26ddc7f
1 file changed
+2
-2
vllm/v1/serial_utils.py
+2
-2
@@ -158,8 +158,8 @@ class MsgpackEncoder:
158
self, obj: torch.Tensor
159
) -> tuple[str, tuple[int, ...], Union[int, memoryview]]:
160
assert self.aux_buffers is not None
161
- # view the tensor as a 1D array of bytes
162
- arr = obj.flatten().view(torch.uint8).numpy()
161
+ # view the tensor as a contiguous 1D array of bytes
162
+ arr = obj.flatten().contiguous().view(torch.uint8).numpy()
163
if obj.nbytes < self.size_threshold:
164
# Smaller tensors are encoded inline, just like ndarrays.
165
data = msgpack.Ext(CUSTOM_TYPE_RAW_VIEW, arr.data)