From a7bfeec9193eeef53756cc6e8dbe5e931abf0a56 Mon Sep 17 00:00:00 2001 From: Daniel Han-Chen Date: Mon, 29 Jan 2024 23:14:51 +1100 Subject: [PATCH] Update utils.py --- unsloth/kernels/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unsloth/kernels/utils.py b/unsloth/kernels/utils.py index 5fe5e3ee16..1eb6735004 100644 --- a/unsloth/kernels/utils.py +++ b/unsloth/kernels/utils.py @@ -207,10 +207,10 @@ def fast_linear_forward(proj, X, temp_lora = None, out = None): if lora_A is not None: dtype = X.dtype if bsz == 1: - temp_lora = torch.mv(lora_A.to(dtype), X.ravel(), out = temp_lora) + temp_lora = torch.mv(lora_A.to(dtype), out.ravel(), out = temp_lora) out.addmv_(lora_B.to(dtype).t(), temp_lora, alpha = lora_S) else: - temp_lora = torch.matmul(X, lora_A.to(dtype).t(), out = temp_lora) + temp_lora = torch.matmul(out, lora_A.to(dtype).t(), out = temp_lora) out.addmm_(lora_B.to(dtype).t(), temp_lora, alpha = lora_S) pass pass