[FIXBUG] Qwen3VL hallucinations without Contiguous on Torch.SDPA (#27744)

Signed-off-by: JartX <sagformas@epdcenter.es>
Co-authored-by: Lukas Geiger <lukas.geiger94@gmail.com>
This commit is contained in:
JartX 2025-10-29 17:55:35 +01:00 committed by GitHub
parent 1da3309ace
commit 7568a282b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -428,6 +428,14 @@ class Qwen2_5_VisionAttention(nn.Module):
)
elif self.attn_backend == _Backend.TORCH_SDPA:
# Execute attention entry by entry for speed & less VRAM.
from vllm.platforms import current_platform
# Never remove the next contiguous logic
# Without it, hallucinations occur with the backend
if current_platform.is_rocm():
q = q.contiguous()
k = k.contiguous()
v = v.contiguous()
outputs = []
for i in range(1, len(cu_seqlens)):
start_idx = cu_seqlens[i - 1]