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

Fix tensor parallelism with SGMV to use true rank of the LoRA after splitting #324

Merged
merged 7 commits into from
Mar 14, 2024

Conversation

tgaddair
Copy link
Contributor

@tgaddair tgaddair commented Mar 13, 2024

Fixes #308.

Previous implementation assumed the rank set in the config was correct and we only need to scale by process group size. However, this may not always be the case depending on how the weights get split for tensor parallelism (column vs row parallel). As such, we should ignore the config and instead rely on the true rank dimension of the tensor independent of the process group size.

@tgaddair tgaddair marked this pull request as ready for review March 13, 2024 05:29
@tgaddair tgaddair mentioned this pull request Mar 13, 2024
4 tasks
@@ -261,9 +261,9 @@ def load_batched_adapter_weights(
lora_a_list = [pad_rank(w, dim=1, world_size=self.world_size) for w in lora_a_list]
lora_b_list = [pad_rank(w, dim=0, world_size=self.world_size) for w in lora_b_list]

if lora_b_list:
if lora_a_list:
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious what the significance of swapping from lora_b_list to lora_a_list here is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the same, actually.

@tgaddair tgaddair merged commit 49f3f53 into main Mar 14, 2024
1 check passed
@tgaddair tgaddair deleted the fix-308 branch March 14, 2024 04:24
@tgaddair tgaddair mentioned this pull request Mar 14, 2024
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.

SGMV not working for llama 70b
2 participants