Gets the current list of active adapters of the model. If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT [documentation](https://huggingface.co/docs/peft).
(self)
| 638 | module.disable_adapters = False |
| 639 | |
| 640 | def active_adapters(self) -> list[str]: |
| 641 | """ |
| 642 | Gets the current list of active adapters of the model. |
| 643 | |
| 644 | If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT |
| 645 | [documentation](https://huggingface.co/docs/peft). |
| 646 | """ |
| 647 | check_peft_version(min_version=MIN_PEFT_VERSION) |
| 648 | |
| 649 | if not is_peft_available(): |
| 650 | raise ImportError("PEFT is not available. Please install PEFT to use this function: `pip install peft`.") |
| 651 | |
| 652 | if not self._hf_peft_config_loaded: |
| 653 | raise ValueError("No adapter loaded. Please load an adapter first.") |
| 654 | |
| 655 | from peft.tuners.tuners_utils import BaseTunerLayer |
| 656 | |
| 657 | for _, module in self.named_modules(): |
| 658 | if isinstance(module, BaseTunerLayer): |
| 659 | return module.active_adapter |
| 660 | |
| 661 | def fuse_lora(self, lora_scale=1.0, safe_fusing=False, adapter_names=None): |
| 662 | if not USE_PEFT_BACKEND: |
nothing calls this directly
no test coverage detected