From 20e9914645f1d47808cc0e2c8215ae2740aa523d Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Tue, 8 Jul 2025 12:33:50 +0300 Subject: [PATCH] Update gguf.py --- gguf/gguf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gguf/gguf.py b/gguf/gguf.py index 2e8c3d3..9e93e67 100644 --- a/gguf/gguf.py +++ b/gguf/gguf.py @@ -36,6 +36,7 @@ def _replace_with_gguf_linear(model, compute_dtype, state_dict, prefix="", modul lora_diffs = None lora_strengths = None + lora_alphas = None if len(patch) != 0: lora_diffs = [p[1].weights for p in patch] lora_strengths = [p[0] for p in patch] @@ -97,7 +98,7 @@ class GGUFLinear(nn.Linear): ).reshape(weight.shape) # Apply the patch with its strength - weight = weight + patch_diff.to(weight.device, self.compute_dtype) * (lora_strength * lora_alpha) + weight = weight + ((lora_strength * lora_alpha) * patch_diff).to(self.compute_dtype) output = torch.nn.functional.linear(inputs, weight, bias) return output \ No newline at end of file