Enable adapters that are attached to the model. The model uses `self.active_adapters()` to retrieve the list of adapters to enable. If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT [documentation](https://hugg
(self)
| 615 | module.disable_adapters = True |
| 616 | |
| 617 | def enable_adapters(self) -> None: |
| 618 | """ |
| 619 | Enable adapters that are attached to the model. The model uses `self.active_adapters()` to retrieve the list of |
| 620 | adapters to enable. |
| 621 | |
| 622 | If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT |
| 623 | [documentation](https://huggingface.co/docs/peft). |
| 624 | """ |
| 625 | check_peft_version(min_version=MIN_PEFT_VERSION) |
| 626 | |
| 627 | if not self._hf_peft_config_loaded: |
| 628 | raise ValueError("No adapter loaded. Please load an adapter first.") |
| 629 | |
| 630 | from peft.tuners.tuners_utils import BaseTunerLayer |
| 631 | |
| 632 | for _, module in self.named_modules(): |
| 633 | if isinstance(module, BaseTunerLayer): |
| 634 | if hasattr(module, "enable_adapters"): |
| 635 | module.enable_adapters(enabled=True) |
| 636 | else: |
| 637 | # support for older PEFT versions |
| 638 | module.disable_adapters = False |
| 639 | |
| 640 | def active_adapters(self) -> list[str]: |
| 641 | """ |
no test coverage detected