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: Avoid needless copy from modules_to_save #2220

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

BenjaminBossan
Copy link
Member

@BenjaminBossan BenjaminBossan commented Nov 18, 2024

Resolves #2206

NOT READY TO MERGE YET. Let's wait for the 0.14.0 release.

Tentative solution to that issue.

The problem is that we keep a "global" modules_to_save on the model which contains all possible modules_to_save for each adapter. When the first adapter targets layer "foo" with modules_to_save and the second adapter targets "bar", then "foo" will create a copy of the original module for the second adapter, even though it's not needed.

This does not change the result but is unnecessary and takes up memory. Thus it should be avoided.

Resolves huggingface#2206

NOT READY TO MERGE YET.

Tentative solution to that issue.

The problem is that we keep a "global" modules_to_save on the model
which contains all possible modules_to_save for each adapter. When the
first adapter targets layer "foo" with modules_to_save and the second
adapter targets "bar", then "foo" will create a copy of the original
module for the second adapter, even though it's not needed.

This does not change the result but is unnecessary and takes up memory.
Thus it should be avoided.

TODO: Tests.
@HuggingFaceDocBuilderDev

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.

@BenjaminBossan BenjaminBossan marked this pull request as ready for review December 16, 2024 14:33
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.

modules_to_save Incorrect Overlap in Multiple LoRA Adapters
2 participants