From b70ad902b4e8bd9b781b81976525f914527dc85f Mon Sep 17 00:00:00 2001 From: Xiangyu Tian <109123695+xiangyuT@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:34:44 +0800 Subject: [PATCH] Fix ipex-llm CPU linear dtype not match (#12805) --- python/llm/src/ipex_llm/transformers/low_bit_linear.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/llm/src/ipex_llm/transformers/low_bit_linear.py b/python/llm/src/ipex_llm/transformers/low_bit_linear.py index 1dd99684..2712d82f 100644 --- a/python/llm/src/ipex_llm/transformers/low_bit_linear.py +++ b/python/llm/src/ipex_llm/transformers/low_bit_linear.py @@ -699,7 +699,7 @@ class LowBitLinear(nn.Linear): if is_server() and (not is_spr()) and \ self.qtype == SYM_INT4 and x_2d.shape[0] >= TORCH_LINEAR_THRESHOLD: x0_fp32 = ggml_int4_convert_fp32(x0, self.weight_shape, self.weight_length) - result = F.linear(x, x0_fp32) + result = F.linear(x.to(dtype=x0_fp32.dtype), x0_fp32) else: # Weight does not need a convert result = ggml_matmul_src1_x_src0_t(x0, x_2d, self.weight_shape, self.qtype)