-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
lora_r is double when converting olora to lora. #2075
Comments
Yes, this is expected. Methods like OLoRA modify the base weights too. When you want to convert the OLoRA weights to LoRA weights, it needs to be ensured that the original base weights can be used. This is only possible by performing some changes on the OLoRA weights, which involves doubling their size. The reason is not quite straightforward to understand but it's explained here (this is for LoftQ but the same idea applies to OLoRA). Ping @tokenizer-decode for info. |
Got it, thanks for your reply |
Found a new problem. After converting to lora model, r and alpha of the base model will be 2r and 2alpha. So maybe it's better to reset them to r and alpha after saving is finished. |
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.
Good point @JaheimLee, I created a PR to address that: #2077. |
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 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.
System Info
transformers
version: 4.44.2Who can help?
No response
Information
Tasks
examples
folderReproduction
Expected behavior
The lora_r of init adapter is 16.
But the converted one is 32.
Model size is also double.
Is it as expected?
The text was updated successfully, but these errors were encountered: