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

updates here #417

Draft
wants to merge 1 commit into
base: gh/H-Huang/1/base
Choose a base branch
from
Draft
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
15 changes: 15 additions & 0 deletions torchtitan/parallelisms/pipelining_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,25 @@ def build_pipeline_schedule(job_config, parallel_dims, stages, loss_fn):
if n_microbatches is None:
n_microbatches = job_config.experimental.pipeline_parallel_degree

if job_config.experimental.pipeline_parallel_schedule == "zb":
stage_index_to_group_rank = {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: there should be a helper fn (in this file iirc) that produces this mapping for you. maybe its not in the right format though? i also wonder if we should land that helper to pytorch in some way.

0: 0,
1: 1,
2: 2,
3: 3,
4: 3,
5: 2,
6: 1,
7: 0,
}
else:
stage_index_to_group_rank = None

schedule = schedule_class(
stages if looped_schedule else stages[0],
n_microbatches=n_microbatches,
loss_fn=loss_fn,
stage_index_to_group_rank=stage_index_to_group_rank,
)

if zb_schedule:
Expand Down
1 change: 1 addition & 0 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ def loss_fn(pred, labels):
# pipeline parallel forward / backward inside step() call

if job_config.experimental.pipeline_parallel_schedule == "zb":
is_last_stage = pp_mesh.get_local_rank() == 0
with loss_parallel_ctx():
if pp_mesh.get_local_rank() == 0:
losses = []
Expand Down
Loading