Skip to content

Commit c9e2d64

Browse files
author
Yu-Zhou
authored
[Hardware][Gaudi][Bugfix] Fix error for guided decoding (#12317)
1 parent 7734e9a commit c9e2d64

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

vllm/model_executor/guided_decoding/outlines_logits_processors.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
from pydantic import BaseModel
3333
from transformers import PreTrainedTokenizerBase
3434

35+
from vllm.platforms import current_platform
36+
3537

3638
class BaseLogitsProcessor:
3739

@@ -91,7 +93,14 @@ def __call__(self, input_ids: List[int],
9193
allowed_tokens = allowed_tokens.masked_select(
9294
allowed_tokens < scores.shape[-1])
9395
mask.index_fill_(0, allowed_tokens, 0)
94-
scores.add_(mask)
96+
if current_platform.is_hpu():
97+
# Workaround for HPU bug where add_() raise RuntimeError:
98+
# synNodeCreateWithId failed for node: strided_insert
99+
# with synStatus 1 [Invalid argument], hopefully it will
100+
# be fixed in the future releases of the HPU runtime.
101+
scores = scores.add(mask)
102+
else:
103+
scores.add_(mask)
95104
return scores
96105

97106

0 commit comments

Comments
 (0)