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 14, 01:45 UTC
[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>
JartX committed
Oct 29, 2025 at 17:55 UTC
7568a282b90f012e199ff71e7813f186a51addec
1 file changed
+8
vllm/model_executor/models/qwen2_5_vl.py
+8
@@ -428,6 +428,14 @@ class Qwen2_5_VisionAttention(nn.Module):
428
)
429
elif self.attn_backend == _Backend.TORCH_SDPA:
430
# Execute attention entry by entry for speed & less VRAM.
431
+ from vllm.platforms import current_platform
432
+
433
+ # Never remove the next contiguous logic
434
+ # Without it, hallucinations occur with the backend
435
+ if current_platform.is_rocm():
436
+ q = q.contiguous()
437
+ k = k.contiguous()
438
+ v = v.contiguous()
439
outputs = []
440
for i in range(1, len(cu_seqlens)):
441
start_idx = cu_seqlens[i - 1]