MCPcopy Index your code
hub / github.com/huggingface/diffusers / enable_adapters

Method enable_adapters

src/diffusers/loaders/peft.py:617–638  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Callers 5

set_adapter_layersFunction · 0.80
disable_adaptersMethod · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 1

check_peft_versionFunction · 0.85

Tested by

no test coverage detected