[MUSA] apply_vocab_mask support musa device (#21296)
This commit is contained in:
@@ -104,11 +104,7 @@ class XGrammarGrammar(BaseGrammarObject):
|
|||||||
return vocab_mask.to(device, non_blocking=True)
|
return vocab_mask.to(device, non_blocking=True)
|
||||||
|
|
||||||
def apply_vocab_mask(self, logits: torch.Tensor, vocab_mask: torch.Tensor) -> None:
|
def apply_vocab_mask(self, logits: torch.Tensor, vocab_mask: torch.Tensor) -> None:
|
||||||
if (
|
if logits.device.type in {"cuda", "npu", "xpu", "musa"}:
|
||||||
logits.device.type == "cuda"
|
|
||||||
or logits.device.type == "npu"
|
|
||||||
or logits.device.type == "xpu"
|
|
||||||
):
|
|
||||||
if _is_hip:
|
if _is_hip:
|
||||||
apply_token_bitmask_inplace_cuda(logits, vocab_mask)
|
apply_token_bitmask_inplace_cuda(logits, vocab_mask)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user