From 47745d57c2ab110ce854f76b279ac03ead63c12c Mon Sep 17 00:00:00 2001 From: Benjamin Bossan Date: Wed, 22 May 2024 16:35:27 +0200 Subject: [PATCH] FIX Use correct attribute name for HQQ in merge (#1791) Without this fix, test_hqq_lora_model_outputs currently fails. --- src/peft/tuners/lora/model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/peft/tuners/lora/model.py b/src/peft/tuners/lora/model.py index 5ebbd66549..1087415607 100644 --- a/src/peft/tuners/lora/model.py +++ b/src/peft/tuners/lora/model.py @@ -236,7 +236,10 @@ def _replace_module(self, parent, child_name, new_module, child): child = child.base_layer if not hasattr(new_module, "base_layer"): - new_module.weight = child.weight + if hasattr(new_module, "W_q"): # HQQ + new_module.W_q = child.W_q + else: + new_module.weight = child.weight if hasattr(child, "bias"): new_module.bias = child.bias