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

FIX: issues with (un)merging multiple LoRA and IA³ adapters #976

Merged

Conversation

BenjaminBossan
Copy link
Member

@BenjaminBossan BenjaminBossan commented Sep 29, 2023

This should resolve the failing slow test test_4bit_merge_and_disable_lora (see e.g. here).

While investigating, I also noticed that merging multiple adapters was not correct for IA³. I added a test that should catch this bug and provided a fix for it too. However, the test does not check IA³ at the moment because the test parameters do not contain IA³. For this, #972 needs to be merged too, which adds IA³ to the test parameters.

Note: I did some small fixes on the tests to avoid exploding/vanishing gradients, as they made it difficult to find the right tolerance for comparing outputs.

This should resolve the failing slow test
test_4bit_merge_and_disable_lora.

While investigating, I also noticed that merging multiple adapters was
not correct for IA³. I added a test that should catch this bug and
provided a fix for it too. However, the test does not check IA³ at the
moment because the test parameters do not contain IA³. For this, huggingface#972
needs to be merged too, which adds IA³ to the test parameters.
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 29, 2023

The documentation is not available anymore as the PR was closed or merged.

Previously, tests had some exploding gradients, making them unstable.
BenjaminBossan added a commit to BenjaminBossan/peft that referenced this pull request Sep 29, 2023
As discussed internally.

After adding support for multiple active adapters, we have some double
bookkeeping when it comes to tracking merged adapters. On the one hand,
we have merged_adapters, which lists all merged adapters, and on the
other hand, we have the merged attribute, which indicates if at least
one adapter is merged.

Having two sources of truth is bad, because it's more work to keep them
in sync and there is a risk of them getting out of sync. Therefore, this
PR removes the .merged attribute. In order to keep the same interface,
we add a merged property, which returns True if there are any
merged_adapters.

This PR also contains some fixes from huggingface#976 to ensure that tests pass.
Copy link
Contributor

@pacman100 pacman100 left a comment

Choose a reason for hiding this comment

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

Thank you @BenjaminBossan for the quick fixes and related tests, LGTM!

@pacman100 pacman100 merged commit 1367bc6 into huggingface:main Oct 3, 2023
@BenjaminBossan BenjaminBossan deleted the fix-issues-adapter-merging branch October 4, 2023 08:16
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