From 333d7b6437419a9df15e22f6a4043fc4d03191db Mon Sep 17 00:00:00 2001 From: "Wang, Yi A" Date: Thu, 6 Nov 2025 21:49:54 -0800 Subject: [PATCH] add xpu to valid hardware for torch.compile Signed-off-by: Wang, Yi A --- src/transformers/generation/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformers/generation/utils.py b/src/transformers/generation/utils.py index 2c407ecfd919..ba3c59f36532 100644 --- a/src/transformers/generation/utils.py +++ b/src/transformers/generation/utils.py @@ -2170,7 +2170,7 @@ def _valid_auto_compile_criteria(self, model_kwargs: dict[str, Any], generation_ return False # Base logic - valid_hardware = self.device.type == "cuda" or bool( + valid_hardware = self.device.type in ["cuda", "xpu"] or bool( generation_config.compile_config is not None and generation_config.compile_config._compile_all_devices ) using_compilable_cache = (