From c8a652853b61192153846350d39bdc1725c2d6a3 Mon Sep 17 00:00:00 2001 From: jiqing-feng Date: Thu, 19 Dec 2024 16:53:47 +0800 Subject: [PATCH] Update optimum/gptq/quantizer.py Co-authored-by: Ilyas Moutawwakil <57442720+IlyasMoutawwakil@users.noreply.github.com> --- optimum/gptq/quantizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/optimum/gptq/quantizer.py b/optimum/gptq/quantizer.py index db77ac0341..844da3e315 100644 --- a/optimum/gptq/quantizer.py +++ b/optimum/gptq/quantizer.py @@ -702,7 +702,7 @@ def tmp(_, input, output): model = self.post_init_model(model) torch.cuda.empty_cache() - if hasattr(torch, "xpu"): + if hasattr(torch, "xpu") and torch.xpu.is_available(): torch.xpu.empty_cache() return model