From a466155a6624ce8c1e1a5c9575ef281b6a8df3b8 Mon Sep 17 00:00:00 2001 From: Kanya-Mo <167922169+Kanya-Mo@users.noreply.github.com> Date: Mon, 1 Jul 2024 10:27:15 -0700 Subject: [PATCH] update the order of xpu condition checking --- ts/torch_handler/base_handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ts/torch_handler/base_handler.py b/ts/torch_handler/base_handler.py index 29af1224e4..fa4be5841c 100644 --- a/ts/torch_handler/base_handler.py +++ b/ts/torch_handler/base_handler.py @@ -158,9 +158,9 @@ def initialize(self, context): self.map_location + ":" + str(properties.get("gpu_id")) ) elif ( - torch.xpu.is_available() + os.environ.get("TS_IPEX_GPU_ENABLE", "false") == "true" and properties.get("gpu_id") is not None - and os.environ.get("TS_IPEX_GPU_ENABLE", "false") == "true" + and torch.xpu.is_available() ): self.map_location = "xpu" self.device = torch.device(