support chatglm3 with bf16 (#9888)

* support chatglm3 with bigdl-bf16
This commit is contained in:
Ziteng Zhang 2024-01-11 16:45:21 +08:00 committed by GitHub
parent 0aef35a965
commit 4af88a67b9

View file

@ -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)