[peft] Given that self.active_adapter is deprecated, avoid using it (#34804)

* Given that self.active_adapter is deprecated, avoid using it

* Remove misleading comment - `self.active_adapter` is not used (and deprecated)
This commit is contained in:
Tom Aarsen 2024-11-25 15:29:52 +01:00 committed by GitHub
parent 74db22f905
commit 11cc2295c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -381,7 +381,7 @@ class PeftAdapterMixin:
If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT
official documentation: https://huggingface.co/docs/peft official documentation: https://huggingface.co/docs/peft
Enable adapters that are attached to the model. The model will use `self.active_adapter()` Enable adapters that are attached to the model.
""" """
check_peft_version(min_version=MIN_PEFT_VERSION) check_peft_version(min_version=MIN_PEFT_VERSION)
@ -457,7 +457,7 @@ class PeftAdapterMixin:
from peft import get_peft_model_state_dict from peft import get_peft_model_state_dict
if adapter_name is None: if adapter_name is None:
adapter_name = self.active_adapter() adapter_name = self.active_adapters()[0]
adapter_state_dict = get_peft_model_state_dict(self, adapter_name=adapter_name) adapter_state_dict = get_peft_model_state_dict(self, adapter_name=adapter_name)
return adapter_state_dict return adapter_state_dict