From 6c31a5fe991169d1caad2426b1cee479af6afd13 Mon Sep 17 00:00:00 2001 From: Artidoro Pagnoni Date: Mon, 27 Feb 2023 14:23:21 -0800 Subject: [PATCH] t5 model fix --- bitsandbytes/nn/modules.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bitsandbytes/nn/modules.py b/bitsandbytes/nn/modules.py index ad3f4f7..5d6d19c 100644 --- a/bitsandbytes/nn/modules.py +++ b/bitsandbytes/nn/modules.py @@ -190,10 +190,10 @@ class LinearFP4(nn.Linear): if getattr(self.weight, 'quant_state', None) is None: print('FP4 quantization state not initialized. Please call .cuda() or .to(device) on the LinearFP4 layer first.') - inp_dtype = x.dtype x = x.to(torch.float16) - out = bnb.matmul_fp4(x, self.weight.t(), bias=self.bias.half(), quant_state=self.weight.quant_state) + bias = None if self.bias is None else self.bias.half() + out = bnb.matmul_fp4(x, self.weight.t(), bias=bias, quant_state=self.weight.quant_state) out = out.to(inp_dtype) return out