[Intel XPU]support xgrammar backend for intel xpu (#13245)
This commit is contained in:
@@ -104,7 +104,11 @@ 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 logits.device.type == "cuda" or logits.device.type == "npu":
|
if (
|
||||||
|
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