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

[AutoParallel]:intermediate api supports LoRA #70539

Merged
merged 9 commits into from
Jan 10, 2025

Conversation

blacksheep-Aristotle
Copy link
Contributor

@blacksheep-Aristotle blacksheep-Aristotle commented Dec 29, 2024

PR Category

Auto Parallel

PR Types

New features

Description

中层api支持lora&添加lora 单测
Pcard-67164

Copy link

paddle-bot bot commented Dec 29, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

"llama.layers.*.mlp.up_proj": dist.ColWiseParallel(),
"llama.layers.*.mlp.down_proj": dist.RowWiseParallel(),
"lm_head.weight": dist.ColWiseParallel(),
f"{prefix}llama.layers.*.self_attn.o_proj.lora_B": dist.RowWiseParallel(),
Copy link
Contributor

@jeff41404 jeff41404 Jan 8, 2025

Choose a reason for hiding this comment

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

because the input of o_proj is RowWiseParallel, so we shall config f"{prefix}llama.layers.*.self_attn.o_proj.lora_A": dist.RowWiseParallel(), rather than q_proj.lora_B?

gather_output=True
),
"llama.layers.*.self_attn.k_proj": dist.ColWiseParallel(
f"{prefix}llama.layers.*.self_attn.q_proj.lora_A": dist.ColWiseParallel(),
Copy link
Contributor

@jeff41404 jeff41404 Jan 8, 2025

Choose a reason for hiding this comment

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

because we shall keep result of lora is ColWiseParallel, so we shall config f"{prefix}llama.layers.*.self_attn.q_proj.lora_B": dist.ColWiseParallel(), rather than q_proj.lora_A?

Copy link
Contributor

Choose a reason for hiding this comment

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

same issue of k_proj.lora_A and v_proj.lora_A

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor Author

@blacksheep-Aristotle blacksheep-Aristotle Jan 8, 2025

Choose a reason for hiding this comment

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

now lora_A is RowWiseParallel when layer is RowWiseParallel.
lora_B is ColWiseParallel when layer is ColWiseParallel

Copy link
Contributor

Choose a reason for hiding this comment

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

lora_B is ColWiseParallel when layer is RowWiseParallel

lora_B is ColWiseParallel when layer is ColWiseParallel?

Comment on lines 167 to 168
shard_param_list.add("weight")
shard_param_list.add("bias")
Copy link
Contributor

Choose a reason for hiding this comment

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

if shard_param_list is not [], should not add weight and bias? consider the plan of shard_param_list is different from weight and bias.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shard_param_list will add weight or bias only when shard_param_list is []

Copy link
Contributor

@jeff41404 jeff41404 left a comment

Choose a reason for hiding this comment

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

LGTM

@blacksheep-Aristotle blacksheep-Aristotle changed the title Intermediate api [AutoParallel]:intermediate api supports LoRA Jan 10, 2025
@jeff41404 jeff41404 merged commit f3546ee into PaddlePaddle:develop Jan 10, 2025
31 of 32 checks passed
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.

3 participants