huggingface / peft

🤗 PEFT: State-of-the-art Parameter-Efficient Fine-Tuning.
https://huggingface.co/docs/peft
Apache License 2.0
16.46k stars 1.62k forks source link

ENH: Improved attribute access for modules_to_save #2117

Closed BenjaminBossan closed 1 month ago

BenjaminBossan commented 1 month ago

Resolves #2099

So far, if a module was wrapped due to modules_to_save, we handled access to the weight and bias attribute (albeit incorrectly in case of disabled adapters!). However, there could be more attributes than those that could be accessed, in which case we got an error so far.

Instead of special properties, we now implement a generic __getattr__ method that can deal with any attribute. The implementation is a bit complex to take into account the way that torch.nn.Module handles __getattr__.

HuggingFaceDocBuilderDev commented 1 month ago

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.