Last active
August 28, 2024 01:30
-
-
Save wassname/e85018faa3fc9ad6980ace5b47bb07d8 to your computer and use it in GitHub Desktop.
Given a peft model work out is adapters are enabled or disabled"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from peft.peft_model import BaseTunerLayer, PeftModel | |
from peft.utils.other import ModulesToSaveWrapper | |
def adapter_is_disabled(model: PeftModel) -> bool: | |
"""Given a peft model work out is adapters are enabled or disabled""" | |
for module in model.model.modules(): | |
if isinstance(module, (BaseTunerLayer, ModulesToSaveWrapper)): | |
# print(help(module.enable_adapters)) | |
return module._disable_adapters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment