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

s_to_r reshard support unbalanced split #67756

Conversation

jeff41404
Copy link
Contributor

@jeff41404 jeff41404 commented Aug 27, 2024

PR Category

Auto Parallel

PR Types

New features

Description

pcard-86471
s_to_r reshard should support unbalanced split or will error in some model (Dit etc)

import paddle
import paddle.distributed as dist
process_mesh = dist.ProcessMesh([0, 1], dim_names=['dp'])

class ParallelLabelEmbedder(nn.Layer):
    def __init__(self, num_classes, hidden_size, dropout_prob):
        ......
        self.embedding_table = nn.Embedding(embedding_dim, hidden_size) # parameter shape=(1001, 1024)
        self.embedding_table.weight = dist.shard_tensor(self.embedding_table.weight, process_mesh, [dist.Replicate()])
        # Although we DO NOT shard the parameters in the forward and backward processes, 
        # But when using sharding parallel(eg. sharding stage 1), the optimizer will shard the parameters
        # at the 0th dimension, (1001/2) resulting unbalanced splitting. 
        # and using all_gather to update parameters, an error will occur

image

Copy link

paddle-bot bot commented Aug 27, 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.

Copy link
Contributor

@JZ-LIANG JZ-LIANG left a comment

Choose a reason for hiding this comment

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

LGTM

@jeff41404 jeff41404 merged commit edcc22b into PaddlePaddle:develop Sep 6, 2024
29 checks passed
@jeff41404 jeff41404 deleted the s_to_r_reshard_support_unbalanced_split branch September 6, 2024 07:39
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.

2 participants