-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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] Handle DoRA better #9547
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree it's better not to load these DoRA weights, as we now pretty much agree with Kohaku that their DoRA implementation is using the other axis.
Just a nit, the unit test could check for the new warning message.
@BenjaminBossan thanks. Does a8fdc76 work for you? @yiyixuxu could you give this a look too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM.
@@ -1125,7 +1136,13 @@ def load_lora_weights( | |||
# First, ensure that the checkpoint is a compatible one and can be successfully loaded. | |||
state_dict = self.lora_state_dict(pretrained_model_name_or_path_or_dict, **kwargs) | |||
|
|||
is_correct_format = all("lora" in key or "dora_scale" in key for key in state_dict.keys()) | |||
is_dora_scale_present = any("dora_scale" in k for k in state_dict) | |||
if is_dora_scale_present: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that we sometimes add this code to lora_state_dict()
and sometimes on load_lora_weights
. Is there any reason we do this differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: I see what you mean. Will update accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
Failing test is unrelated. |
* handle dora. * print test * debug * fix * fix-copies * update logits * add warning in the test. * make is_dora check consistent. * fix-copies
* handle dora. * print test * debug * fix * fix-copies * update logits * add warning in the test. * make is_dora check consistent. * fix-copies
What does this PR do?
Our support for loading community DoRA checkpoints is currently broken. See KohakuBlueleaf/LyCORIS#216.
So, this PR:
dora_scale
present. Upon detection, it logs a warning about the incompatibility and filters the state dict so that it doesn't have thedora_scale
keys.Once Ben gives a go ahead I will request for a review from Yiyi.