Skip to content

Conversation

@yushangdi
Copy link

A tutorial for DebugMode

cc @pianpwk

@pytorch-bot
Copy link

pytorch-bot bot commented Dec 11, 2025

🔗 Helpful Links

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

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 89931fb with merge base 05681a1 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@meta-cla meta-cla bot added the cla signed label Dec 11, 2025
@yushangdi yushangdi force-pushed the sy_debug_mode branch 2 times, most recently from 70107fb to 6e85e8a Compare December 12, 2025 00:03
@yushangdi yushangdi changed the title [WIP, do not review yet] Tutorial for DebugMode Tutorial for DebugMode Dec 12, 2025
@yushangdi yushangdi requested a review from pianpwk December 12, 2025 00:03
@yushangdi yushangdi marked this pull request as ready for review December 12, 2025 00:04
@yushangdi yushangdi added the 2.10 2.10 PyTorch release label label Dec 12, 2025
Copy link

@Lucaskabela Lucaskabela left a comment

Choose a reason for hiding this comment

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

I think one thing that would be very helpful for this tutorial is a log where the compiled and eager mode diverge - this could be extremely value to show users what they should be looking for. Can we add that here?

# Hooks allow you to annotate each call with custom metadata such as GPU memory usage. ``log_hook`` returns a mapping
# that is rendered inline with the debug string.

MB = 1024 * 1024.0
Copy link
Contributor

Choose a reason for hiding this comment

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

We should call out somewhere that with all context managers: DebugMode(), log_tensor_hashes(), dispatch_hooks(), you can wrap them around any particular region (except inside compiled regions). So the wrappers aren't global.

Copy link
Author

Choose a reason for hiding this comment

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

hmm, i think the "except inside compiled regions" part can be confusing, so I'd prefer to leave this one out.

@pianpwk
Copy link
Contributor

pianpwk commented Dec 12, 2025

overall looks great!

@yushangdi yushangdi force-pushed the sy_debug_mode branch 2 times, most recently from 3c67013 to e1931d2 Compare December 12, 2025 03:27
@svekars svekars requested a review from AlannaBurke December 12, 2025 16:55
Copy link

@Lucaskabela Lucaskabela left a comment

Choose a reason for hiding this comment

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

This looks good to me! Thank you for incorporate the feedback - can we link this PR to a RFC in main repo as well?

Copy link
Contributor

@pianpwk pianpwk left a comment

Choose a reason for hiding this comment

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

thank you!

Copy link
Contributor

@svekars svekars left a comment

Choose a reason for hiding this comment

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

Please include into a relevant toctree in one of the related .rst file. And please don't merge until the doc team does the review. We typically merge closer to the release date.

@yushangdi
Copy link
Author

Please include into a relevant toctree in one of the related .rst file.

sure, added now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.10 2.10 PyTorch release label cla signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants