-
Notifications
You must be signed in to change notification settings - Fork 6.5k
[LoRA] add support for more Qwen LoRAs #12581
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
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. |
|
@bot /style |
|
Style fix runs successfully without any file modified. |
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.
Thank you! I left some minor yet important nits. Once those are addressed, we can ship!
|
|
||
| state_dict = {convert_key(k): v for k, v in state_dict.items()} | ||
|
|
||
| has_default = any("default." in k for k in state_dict) |
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.
If it's starting with "default.", then let's be explicit about that:
| has_default = any("default." in k for k in state_dict) | |
| has_default = any(k.startswith("default.") for k in state_dict) |
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.
"default" isn't the prefix though, e.g.transformer_blocks.0.attn.add_v_proj.lora_A.default.weight
| if has_default: | ||
| state_dict = {k.replace("default.", ""): v for k, v in state_dict.items()} |
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.
So, that it's done as intended:
| if has_default: | |
| state_dict = {k.replace("default.", ""): v for k, v in state_dict.items()} | |
| if has_default: | |
| state_dict = {k[len("default."):]: v for k, v in state_dict.items()} |
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.
same comment as here - 'default' is not in the key's prefix, so this won't be the intended behavior in this case
| has_lora_unet = any(k.startswith("lora_unet_") for k in state_dict) | ||
| has_diffusion_model = any(k.startswith("diffusion_model.") for k in state_dict) | ||
| if has_alphas_in_sd or has_lora_unet or has_diffusion_model: | ||
| has_default = any("default." in k for k in state_dict) |
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.
Same as above.
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.
same comment as #12581 (comment) - 'default' is not in the key's prefix, so this won't be the intended behavior in this case
add support for dx8152's Qwen loras (e.g. https://huggingface.co/dx8152/Qwen-Edit-2509-Multiple-angles)