Skip to content
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

Refactor adapter composition implementation #591

Merged
merged 11 commits into from
Oct 29, 2023

Conversation

calpt
Copy link
Member

@calpt calpt commented Oct 9, 2023

Refactors the implementation of composition blocks in the model forward pass such that more of the logic is shared between all adapter methods.

Changes

Todo

  • Base implementation
  • Passing tests
  • Documentation (in contributing docs)
  • Support average composition for prefix tuning
  • Support compositions for LoRA/ (IA)³

cc @TimoImhof would be nice to run some backwards compability tests here :)

@lenglaender lenglaender mentioned this pull request Oct 18, 2023
Copy link
Member

@lenglaender lenglaender left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me 👍
Can be merged once the backwards compatibility tests have been run (and once the part of the TODOs we want to do in this PR has been implemented).

And maybe rename tests_adapters/methods/test_adapter_common.py to sth. like tests_adapters/methods/test_bottleneck_adapter.py

src/adapters/methods/bottleneck.py Show resolved Hide resolved
src/adapters/methods/bottleneck.py Outdated Show resolved Hide resolved
@calpt
Copy link
Member Author

calpt commented Oct 25, 2023

@hSterz @lenglaender also updated the docs accordingly now. Feel free to have another look.

@calpt calpt marked this pull request as ready for review October 25, 2023 20:09
@lenglaender
Copy link
Member

The documentation looks good to me

@calpt calpt merged commit dfe17e9 into adapter-hub:adapters Oct 29, 2023
5 checks passed
@calpt calpt deleted the dev/x-adapters branch October 29, 2023 11:00
calpt added a commit that referenced this pull request Nov 18, 2023
Follow-up to #591.

This PR provides initial support for adapter composition in LoRA & (IA)³
modules. Currently LoRA & (IA)³ don't support composition. With this PR,
the following blocks will be supported: **Stack, BatchSplit, Average,
Parallel**

Additionally, the LoRA implementation is refactored a bit in an effort
to make it cleaner.

### Limitations
- Split & Fuse compositions are **not** supported
- LoRA/ (IA)³ composition is **not** supported for models using the
`LoRAMergedLinear` implementation. These currently are: **GPT-2, DeBERTa
(v1)**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants