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
vllm_cscc
Commits
0b1447f8
Unverified
Commit
0b1447f8
authored
May 29, 2025
by
Lukas Geiger
Committed by
GitHub
May 29, 2025
Browse files
[Bugfix] Ensure tensors are contiguous during serialisation (#18860)
Signed-off-by:
Lukas Geiger
<
lukas.geiger94@gmail.com
>
parent
24d0ef89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
vllm/v1/serial_utils.py
vllm/v1/serial_utils.py
+2
-2
No files found.
vllm/v1/serial_utils.py
View file @
0b1447f8
...
@@ -158,8 +158,8 @@ class MsgpackEncoder:
...
@@ -158,8 +158,8 @@ class MsgpackEncoder:
self
,
obj
:
torch
.
Tensor
self
,
obj
:
torch
.
Tensor
)
->
tuple
[
str
,
tuple
[
int
,
...],
Union
[
int
,
memoryview
]]:
)
->
tuple
[
str
,
tuple
[
int
,
...],
Union
[
int
,
memoryview
]]:
assert
self
.
aux_buffers
is
not
None
assert
self
.
aux_buffers
is
not
None
#
view the tensor as a 1D array of bytes
# view the tensor as a
contiguous
1D array of bytes
arr
=
obj
.
flatten
().
view
(
torch
.
uint8
).
numpy
()
arr
=
obj
.
flatten
().
contiguous
().
view
(
torch
.
uint8
).
numpy
()
if
obj
.
nbytes
<
self
.
size_threshold
:
if
obj
.
nbytes
<
self
.
size_threshold
:
# Smaller tensors are encoded inline, just like ndarrays.
# Smaller tensors are encoded inline, just like ndarrays.
data
=
msgpack
.
Ext
(
CUSTOM_TYPE_RAW_VIEW
,
arr
.
data
)
data
=
msgpack
.
Ext
(
CUSTOM_TYPE_RAW_VIEW
,
arr
.
data
)
...
...
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