From a27ac6175eaaf19e1a535e2dc8452cf62b3c8d90 Mon Sep 17 00:00:00 2001 From: Daniel Han-Chen Date: Sat, 27 Jan 2024 04:03:47 +1100 Subject: [PATCH] Update utils.py --- unsloth/kernels/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unsloth/kernels/utils.py b/unsloth/kernels/utils.py index 7c693a6c4e..e22e3a11b9 100644 --- a/unsloth/kernels/utils.py +++ b/unsloth/kernels/utils.py @@ -179,7 +179,10 @@ pass def fast_linear_forward(proj, X, temp_lora = None, out = None): W, W_quant, lora_A, lora_B, lora_S = get_lora_parameters(proj) - out = fast_gemv(X, W, W_quant, out = out) + if W_quant is None: + out = torch.matmul(X, W.t()) + else: + out = fast_gemv(X, W, W_quant, out = out) if lora_A is not None: # Save LoRAs for inference to stop data movement costs