From 83ceb11cc9b76796826821ecc93e4ab6fe320802 Mon Sep 17 00:00:00 2001 From: Daniel Han-Chen Date: Sat, 27 Jan 2024 03:12:53 +1100 Subject: [PATCH] Update fast_lora.py --- unsloth/kernels/fast_lora.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unsloth/kernels/fast_lora.py b/unsloth/kernels/fast_lora.py index cceeac2d64..82bd4c0c19 100644 --- a/unsloth/kernels/fast_lora.py +++ b/unsloth/kernels/fast_lora.py @@ -161,16 +161,16 @@ class LoRA_MLP(torch.autograd.Function): # (D @ W.T * f) @ U.T upW = fast_dequantize(upW.t(), upW_quant) # (D @ W.T * f) @ (U.T + B.T @ A.T) - dX = torch.matmul(DW_f, upW.t(), out = X) + dX = torch.matmul(DW_f, upW.t()) del upW dX += (DW_f @ upB.to(dtype).t() @ (upS * upA.to(dtype).t())) # And add the derivative for the gate projection gateW = fast_dequantize(gateW.t(), gateW_quant) # new_dX2 = DW_dfg @ gateW.t() + dX += DW_dfg @ gateB.to(dtype).t() @ (gateS * gateA.to(dtype).t()) dX += DW_dfg @ gateW.t() del gateW - dX += DW_dfg @ gateB.to(dtype).t() @ (gateS * gateA.to(dtype).t()) # gateW, gateW_quant, gateA, gateB, gateS, # upW, upW_quant, upA, upB, upS,