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

[Distributed] Cancel FthenB’s restrictions on local batch size #60134

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1288,13 +1288,9 @@ def forward_backward_pipeline(
self._forward_only = forward_only

assert (
self.accumulate_steps >= self.num_stages
), "accumulate_steps({}) should be larger than num_stages({}) for pipeline with interleave".format(
self.accumulate_steps, self.num_stages
)
assert (
self.accumulate_steps < 2 * self.num_stages
), "accumulate_steps({}) should be smaller than 2 * num_stages({}) for pipeline with interleave".format(
self.accumulate_steps == self.num_stages
or self.accumulate_steps % self.num_stages != 0
), "accumulate_steps({}) and num_stages({}) should be a multiple or accumulate_steps % num_stages == 0".format(
self.accumulate_steps, self.num_stages
)

Expand Down
13 changes: 6 additions & 7 deletions python/paddle/distributed/fleet/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,16 @@ def forward(self, x):
accumulate_steps = strategy.pipeline_configs['accumulate_steps']
pp_degree = fleet_env._hcg.get_pipe_parallel_world_size()
if (
accumulate_steps >= pp_degree
and accumulate_steps < pp_degree * 2
accumulate_steps > pp_degree
and accumulate_steps % pp_degree == 0
):
# NOTE(shenliang03): Hacky for unbalanced pipeline parallel with interleave
# Currently, we only support pp_degree <= accumulate_steps < 2 * pp_degree
model = PipelineParallelWithInterleaveFthenB(
# interleave pipeline
model = PipelineParallelWithInterleave(
model, fleet_env._hcg, strategy=strategy
)
else:
# interleave pipeline
model = PipelineParallelWithInterleave(
# NOTE(shenliang03): Hacky for unbalanced pipeline parallel with interleave
model = PipelineParallelWithInterleaveFthenB(
model, fleet_env._hcg, strategy=strategy
)

Expand Down