-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for AdapterPlus #746
Conversation
…_ and forward functions in Adapter class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a first review pass, looks pretty solid overall! thanks for working on this!
Could you additionally add the new config to relevant locations in the docs. e.g. methods.md
and classes/adapter_config
?
src/adapters/__init__.py
Outdated
@@ -40,6 +40,7 @@ | |||
"DEFAULT_ADAPTER_CONFIG", | |||
"DEFAULT_ADAPTERFUSION_CONFIG", | |||
"AdapterConfig", | |||
"AdapterPlusConfig", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imports are added twice in this file, once here and once in the type checking block below
@calpt It looks like there is a missing |
you're right, it's not currently installed in CI. we could add it as optional dependency in setup.py, similar to what HF does here: https://github.com/huggingface/transformers/blob/405b56269812056d9593869e22b7b264d806cb1e/setup.py#L312 and then install that additional dep package here
|
Would you like that in a separate pr? I know other open-source libraries prefer another pr to differentiate scopes of pull requests, so just wondering what your preference is |
Please correct me if I'm wrong, but wouldn't Thats sort of why I originally wrote the native implementation in the library so that we don't need to include any new core dependencies for |
fine to include here since this is directly related to the new functionality implemented in this pr |
that's a good point. I think what we can do is to make the import of torchvision conditional on the package being available. this is pretty standard practice across Transformers and they have helper methods for checking all sorts of packages, including torchvision: https://github.com/huggingface/transformers/blob/33868a057c02f0368ba63bd1edb746be38fe3d90/src/transformers/utils/import_utils.py#L361 If torchvision is not installed & stochastic_depth is used, we should thrown an exception, otherwise we don't care whether it's installed. This keeps it optional for all non-vision use cases. |
… as a install dep in tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me overall, thanks a lot for working on this!
can be merged from my side once all checks are passing
I have fixed the code quality issues - thanks! |
This PR aims to add support for AdapterPlus
Github: https://github.com/visinf/adapter_plus
Paper: https://arxiv.org/pdf/2406.06820
Integration of AdapterPlus into the
adapters
library will involve adding new parameters/options to theBnConfig
Checklist of things that are added/to be added
scaling
calledchannel
, in which we add learnable parameters for the channel/input_size dimensioninit_weights
calledhoulsby
, where the projection matricesdrop_path
, also known as stochastic depth ONLY applicable for vision based tasks using residual networks - located under a new file called/methods/vision.py