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