Skip to content

Commit

Permalink
Fix adapter name handling
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminBossan committed Apr 18, 2024
1 parent 5979b7b commit fec23e7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/peft/tuners/vera/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def _create_and_replace(
)
else:
new_module = self._create_new_module(vera_config, self.vera_A, self.vera_B, adapter_name, target, **kwargs)
if adapter_name != self.active_adapter:
if adapter_name not in self.active_adapter:
# adding an additional adapter: it is not automatically trainable
new_module.requires_grad_(False)
self._replace_module(parent, target_name, new_module, target)
Expand Down Expand Up @@ -371,6 +371,7 @@ def set_adapter(self, adapter_name):
warnings.warn("Adapter cannot be set when the model is merged. Unmerging the model first.")
module.unmerge()
module.set_adapter(adapter_name)
self.active_adapter = adapter_name

@staticmethod
def _prepare_adapter_config(peft_config, model_config):
Expand Down

0 comments on commit fec23e7

Please sign in to comment.