Skip to content

Commit d03d33d

Browse files
zyongyesimon-mo
authored andcommitted
[gpt-oss] Enhance error msg on attention sink init (vllm-project#22335)
Signed-off-by: simon-mo <[email protected]> Signed-off-by: Yongye Zhu <[email protected]> Co-authored-by: simon-mo <[email protected]>
1 parent 72be1cd commit d03d33d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

vllm/v1/attention/backends/flashinfer.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -638,11 +638,15 @@ def __init__(
638638

639639
self.sinks: Optional[torch.Tensor] = None
640640
if sinks is not None:
641-
assert sinks.shape[0] == num_heads, (
642-
"Sinks must have the same number of heads "
643-
"as the number of heads in the layer"
644-
)
645-
assert sinks.dtype == torch.float32, "Sinks must be of type float32"
641+
if sinks.shape[0] != num_heads:
642+
raise ValueError(
643+
"Sinks must have the same number of heads as the number of "
644+
f"heads in the layer. Expected {num_heads}, but got "
645+
f"{sinks.shape[0]}."
646+
)
647+
if sinks.dtype != torch.float32:
648+
raise ValueError("Sinks must be of type float32, but got "
649+
f"{sinks.dtype}.")
646650
self.sinks = sinks
647651

648652
def forward(

0 commit comments

Comments
 (0)