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

ENH: PiSSA/OLoRA: Preserve original config on save #2077

Conversation

BenjaminBossan
Copy link
Member

@BenjaminBossan BenjaminBossan commented Sep 19, 2024

Resolves #2075

When saving PiSSA or OLoRA with the option to convert to normal LoRA, the LoRA weight shapes change, which means that some values like r and lora_alpha need to be adjusted in the saved PEFT config. However, these modifications should be limited to the saved config, while the loaded config should stay the same.

This PR implements this change by creating a copy of the config before modifying it.

Resolves huggingface#2075

When saving PiSSA or OLoRA with the option to convert to normal LoRA,
the LoRA weight shapes change, which means that some values like r and
alpha need to be adjusted in the saved PEFT config. However, these
modifications should be limited to the saved config, while the loaded
config should stay the same.

This PR implements this change by creating a copy of the config before
modifying it.
@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.

@tokenizer-decode
Copy link
Contributor

Nice catch. LGTM.

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Copy goes a long way

@BenjaminBossan BenjaminBossan merged commit 152ed70 into huggingface:main Sep 20, 2024
14 checks passed
@BenjaminBossan BenjaminBossan deleted the enh-pissa-olora-not-modify-config-on-save branch September 20, 2024 10:11
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.

lora_r is double when converting olora to lora.
4 participants