From 4d28e29236bd987f80b23c8c2b5f94db6280bb2d Mon Sep 17 00:00:00 2001 From: "Wang, Yi A" Date: Tue, 30 Jul 2024 19:28:59 -0700 Subject: [PATCH] hotfix: fix xpu crash brought by code refine. torch.xpu rely on import ipex Signed-off-by: Wang, Yi A --- server/text_generation_server/utils/import_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/text_generation_server/utils/import_utils.py b/server/text_generation_server/utils/import_utils.py index 7c053014..782b4f15 100644 --- a/server/text_generation_server/utils/import_utils.py +++ b/server/text_generation_server/utils/import_utils.py @@ -56,6 +56,8 @@ elif torch.version.cuda is not None and torch.cuda.is_available(): get_free_memory = get_cuda_free_memory elif is_ipex_available(): SYSTEM = "ipex" + import intel_extension_for_pytorch # noqa: F401 + if hasattr(torch, "xpu") and torch.xpu.is_available(): empty_cache = torch.xpu.empty_cache synchronize = torch.xpu.synchronize