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
2410132b
Unverified
Commit
2410132b
authored
Dec 17, 2025
by
TJian
Committed by
GitHub
Dec 16, 2025
Browse files
[ROCm] [Bugfix] Fix torch sdpa hallucination (#30789)
Signed-off-by:
tjtanaa
<
tunjian.tan@embeddedllm.com
>
parent
0a1ab1e5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
vllm/attention/ops/vit_attn_wrappers.py
vllm/attention/ops/vit_attn_wrappers.py
+8
-0
No files found.
vllm/attention/ops/vit_attn_wrappers.py
View file @
2410132b
...
@@ -16,6 +16,7 @@ import einops
...
@@ -16,6 +16,7 @@ import einops
import
torch
import
torch
import
torch.nn.functional
as
F
import
torch.nn.functional
as
F
from
vllm.platforms
import
current_platform
from
vllm.utils.torch_utils
import
direct_register_custom_op
from
vllm.utils.torch_utils
import
direct_register_custom_op
...
@@ -89,6 +90,13 @@ def torch_sdpa_wrapper(
...
@@ -89,6 +90,13 @@ def torch_sdpa_wrapper(
v
:
torch
.
Tensor
,
v
:
torch
.
Tensor
,
cu_seqlens
:
torch
.
Tensor
,
cu_seqlens
:
torch
.
Tensor
,
)
->
torch
.
Tensor
:
)
->
torch
.
Tensor
:
# Never remove the contiguous logic for ROCm
# Without it, hallucinations occur with the backend
if
current_platform
.
is_rocm
():
q
=
q
.
contiguous
()
k
=
k
.
contiguous
()
v
=
v
.
contiguous
()
outputs
=
[]
outputs
=
[]
lens
=
(
cu_seqlens
[
1
:]
-
cu_seqlens
[:
-
1
]).
tolist
()
lens
=
(
cu_seqlens
[
1
:]
-
cu_seqlens
[:
-
1
]).
tolist
()
...
...
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