From 4af88a67b9c9d966212a768e9a53664dda66a2bd Mon Sep 17 00:00:00 2001 From: Ziteng Zhang <87107332+Jasonzzt@users.noreply.github.com> Date: Thu, 11 Jan 2024 16:45:21 +0800 Subject: [PATCH] support chatglm3 with bf16 (#9888) * support chatglm3 with bigdl-bf16 --- python/llm/src/bigdl/llm/transformers/low_bit_linear.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python/llm/src/bigdl/llm/transformers/low_bit_linear.py b/python/llm/src/bigdl/llm/transformers/low_bit_linear.py index c63fd1e9..1cb6b5c5 100644 --- a/python/llm/src/bigdl/llm/transformers/low_bit_linear.py +++ b/python/llm/src/bigdl/llm/transformers/low_bit_linear.py @@ -665,7 +665,5 @@ class BF16Linear(nn.Linear): if self.bias is not None and self.bias.dtype != x.dtype: self.bias.data = self.bias.data.to(x.dtype) - result = F.linear(x, self.weight) - if self.bias is not None: - result += self.bias + result = F.linear(x, self.weight, self.bias) return result.to(x.dtype)