Skip to content

[PP] Add optional argument to not save outputs#165822

Closed
H-Huang wants to merge 4 commits intogh/H-Huang/227/basefrom
gh/H-Huang/227/head
Closed

[PP] Add optional argument to not save outputs#165822
H-Huang wants to merge 4 commits intogh/H-Huang/227/basefrom
gh/H-Huang/227/head

Conversation

@H-Huang
Copy link
Member

@H-Huang H-Huang commented Oct 18, 2025

Stack from ghstack (oldest at bottom):

Fix #159251

Add an optional argument return_outputs to the schedule step

cc @awgu @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k @pragupta @msaroufim @dcci

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 18, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/165822

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit c03169d with merge base fe80f03 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

H-Huang added a commit that referenced this pull request Oct 18, 2025
@pytorch-bot pytorch-bot bot added the oncall: distributed Add this issue/PR to distributed oncall triage queue label Oct 18, 2025
@H-Huang H-Huang added the release notes: distributed (pipeline) release notes category label Oct 18, 2025
[ghstack-poisoned]
H-Huang added a commit that referenced this pull request Oct 18, 2025
@H-Huang H-Huang added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 18, 2025
[ghstack-poisoned]
H-Huang added a commit that referenced this pull request Oct 18, 2025
[ghstack-poisoned]
H-Huang added a commit that referenced this pull request Oct 18, 2025
if self.rank == self.world_size - 1:
output = schedule.step(target=target, losses=losses, return_outputs=False)
else:
schedule.step(x)
Copy link
Contributor

Choose a reason for hiding this comment

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

technically output is None for this line too, right?

Copy link
Member Author

@H-Huang H-Huang Oct 20, 2025

Choose a reason for hiding this comment

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

yep that is also None (every rank without the last stage returns None)

Copy link
Contributor

@wconstab wconstab left a comment

Choose a reason for hiding this comment

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

looks good to me.
testing that we actually do not save stuff seems (instead of just that we do not return stuff) seems safer in a paranoid sense, if you can think of a way to do that.

@H-Huang
Copy link
Member Author

H-Huang commented Oct 21, 2025

testing that we actually do not save stuff seems (instead of just that we do not return stuff) seems safer in a paranoid sense, if you can think of a way to do that.

Yeah agree there, maybe there can be a way to verify the memory usage doesn't increase significantly when increasing # of microbatches. I will think about it

@H-Huang
Copy link
Member Author

H-Huang commented Oct 21, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

Chao1Han pushed a commit to Chao1Han/pytorch that referenced this pull request Oct 21, 2025
Fix pytorch#159251

Add an optional argument `return_outputs` to the schedule `step`

Pull Request resolved: pytorch#165822
Approved by: https://github.com/wconstab
zhudada0120 pushed a commit to zhudada0120/pytorch that referenced this pull request Oct 22, 2025
Fix pytorch#159251

Add an optional argument `return_outputs` to the schedule `step`

Pull Request resolved: pytorch#165822
Approved by: https://github.com/wconstab
H-Huang added a commit to pytorch/torchtitan that referenced this pull request Oct 22, 2025
Uses the API added in pytorch/pytorch#165822,
since we do not return any output from PP step(). This allows us to
release the memory earlier,
jquesnelle pushed a commit to NousResearch/torchtitan that referenced this pull request Nov 10, 2025
Uses the API added in pytorch/pytorch#165822,
since we do not return any output from PP step(). This allows us to
release the memory earlier,
@github-actions github-actions bot deleted the gh/H-Huang/227/head branch November 20, 2025 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged oncall: distributed Add this issue/PR to distributed oncall triage queue release notes: distributed (pipeline) release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants