Skip to content

Commit

Permalink
Update train.py
Browse files Browse the repository at this point in the history
Co-authored-by: tianyu-l <[email protected]>
  • Loading branch information
H-Huang and tianyu-l authored Feb 10, 2025
1 parent 51939f7 commit 76974bf
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,7 @@ def loss_fn(pred, labels):
if parallel_dims.pp_enabled:
# Pipeline Parallel forward / backward inside step() call
with train_context(optional_context_parallel_ctx):
targets = labels if has_last_stage else None
losses = [] if has_last_stage else None
targets, losses = (labels, []) if has_last_stage else (None, None)
if has_first_stage:
pp_schedule.step(input_ids, target=targets, losses=losses)
else:
Expand Down

0 comments on commit 76974bf

Please sign in to comment.